miner: expose max-block-weight config option.

This commit is contained in:
Christopher Jeffrey 2017-02-25 22:25:29 -08:00
parent 386ef622c0
commit 3ec781ee60
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
3 changed files with 9 additions and 2 deletions

View File

@ -469,6 +469,8 @@ Miner.prototype.build = function build(attempt) {
assert(block.getWeight() <= attempt.weight,
'Block exceeds reserved weight!');
assert(block.getBaseSize() <= consensus.MAX_BLOCK_SIZE,
'Block exceeds max block size.');
};
/**
@ -566,12 +568,15 @@ MinerOptions.prototype.fromOptions = function fromOptions(options) {
if (options.maxWeight != null) {
assert(util.isNumber(options.maxWeight));
assert(options.maxWeight <= consensus.MAX_BLOCK_WEIGHT,
'Max weight must be below MAX_BLOCK_WEIGHT');
this.maxWeight = options.maxWeight;
}
if (options.maxSigops != null) {
assert(util.isNumber(options.maxSigops));
assert(options.maxSigops <= consensus.MAX_BLOCK_SIGOPS_COST);
assert(options.maxSigops <= consensus.MAX_BLOCK_SIGOPS_COST,
'Max sigops must be below MAX_BLOCK_SIGOPS_COST');
this.maxSigops = options.maxSigops;
}

View File

@ -281,6 +281,7 @@ config.toOptions = function toOptions(data) {
// Miner
options.payoutAddress = list(data.payoutaddress);
options.coinbaseFlags = str(data.coinbaseflags);
options.maxBlockWeight = num(data.maxblockweight);
// HTTP
options.sslCert = file(data.sslcert, prefix);

View File

@ -119,7 +119,8 @@ function FullNode(options) {
mempool: this.mempool,
fees: this.fees,
address: this.options.payoutAddress,
coinbaseFlags: this.options.coinbaseFlags
coinbaseFlags: this.options.coinbaseFlags,
maxWeight: this.options.maxBlockWeight
});
// Wallet database needs access to fees.