constants: minor.
This commit is contained in:
parent
3236c367b1
commit
d396cdd0fd
@ -33,7 +33,7 @@ var Logger = require('../node/logger');
|
|||||||
var IP = require('../utils/ip');
|
var IP = require('../utils/ip');
|
||||||
var encoding = require('../utils/encoding');
|
var encoding = require('../utils/encoding');
|
||||||
var consensus = require('../protocol/consensus');
|
var consensus = require('../protocol/consensus');
|
||||||
var USER_VERSION = require('../../package.json').version;
|
var pkg = require('../../package.json');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RPC
|
* RPC
|
||||||
@ -324,7 +324,7 @@ RPC.prototype.getinfo = co(function* getinfo(args) {
|
|||||||
balance = yield this.wallet.getBalance();
|
balance = yield this.wallet.getBalance();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
version: USER_VERSION,
|
version: pkg.version,
|
||||||
protocolversion: this.pool.protoVersion,
|
protocolversion: this.pool.protoVersion,
|
||||||
walletversion: 0,
|
walletversion: 0,
|
||||||
balance: Amount.btc(balance.unconfirmed, true),
|
balance: Amount.btc(balance.unconfirmed, true),
|
||||||
@ -377,7 +377,7 @@ RPC.prototype.getnetworkinfo = co(function* getnetworkinfo(args) {
|
|||||||
throw new RPCError('getnetworkinfo');
|
throw new RPCError('getnetworkinfo');
|
||||||
|
|
||||||
return {
|
return {
|
||||||
version: USER_VERSION,
|
version: pkg.version,
|
||||||
subversion: this.pool.userAgent,
|
subversion: this.pool.userAgent,
|
||||||
protocolversion: this.pool.protoVersion,
|
protocolversion: this.pool.protoVersion,
|
||||||
localservices: this.pool.address.services,
|
localservices: this.pool.address.services,
|
||||||
@ -2728,7 +2728,7 @@ RPC.prototype.dumpwallet = co(function* dumpwallet(args) {
|
|||||||
file = toString(args[0]);
|
file = toString(args[0]);
|
||||||
time = util.date();
|
time = util.date();
|
||||||
out = [
|
out = [
|
||||||
util.fmt('# Wallet Dump created by BCoin %s', USER_VERSION),
|
util.fmt('# Wallet Dump created by BCoin %s', pkg.version),
|
||||||
util.fmt('# * Created on %s', time),
|
util.fmt('# * Created on %s', time),
|
||||||
util.fmt('# * Best block at time of backup was %d (%s),',
|
util.fmt('# * Best block at time of backup was %d (%s),',
|
||||||
this.chain.height, this.chain.tip.rhash()),
|
this.chain.height, this.chain.tip.rhash()),
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var USER_VERSION = require('../../package.json').version;
|
var pkg = require('../../package.json');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default protocol version.
|
* Default protocol version.
|
||||||
@ -85,7 +85,7 @@ exports.REQUIRED_SERVICES = 0
|
|||||||
* @default
|
* @default
|
||||||
*/
|
*/
|
||||||
|
|
||||||
exports.USER_AGENT = '/bcoin:' + USER_VERSION + '/';
|
exports.USER_AGENT = '/bcoin:' + pkg.version + '/';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Max message size (~4mb with segwit, formerly 2mb)
|
* Max message size (~4mb with segwit, formerly 2mb)
|
||||||
|
|||||||
@ -27,6 +27,28 @@ exports.COIN = 100000000;
|
|||||||
|
|
||||||
exports.MAX_MONEY = 21000000 * exports.COIN;
|
exports.MAX_MONEY = 21000000 * exports.COIN;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base block subsidy (consensus).
|
||||||
|
* Note to shitcoin implementors: if you
|
||||||
|
* increase this to anything greater than
|
||||||
|
* 33 bits, getReward will have to be
|
||||||
|
* modified to handle the shifts.
|
||||||
|
* @const {Amount}
|
||||||
|
* @default
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports.BASE_REWARD = 50 * exports.COIN;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Half base block subsidy. Required to
|
||||||
|
* calculate the reward properly (with
|
||||||
|
* only 32 bit shifts available).
|
||||||
|
* @const {Amount}
|
||||||
|
* @default
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports.HALF_REWARD = Math.floor(exports.BASE_REWARD / 2);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maximum block base size (consensus).
|
* Maximum block base size (consensus).
|
||||||
* @const {Number}
|
* @const {Number}
|
||||||
@ -302,7 +324,7 @@ exports.getReward = function getReward(height, interval) {
|
|||||||
// cheat. We only start halving once the
|
// cheat. We only start halving once the
|
||||||
// halvings are at least 1.
|
// halvings are at least 1.
|
||||||
if (halvings === 0)
|
if (halvings === 0)
|
||||||
return 5000000000;
|
return exports.BASE_REWARD;
|
||||||
|
|
||||||
return 2500000000 >>> (halvings - 1);
|
return exports.HALF_REWARD >>> (halvings - 1);
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user