diff --git a/lib/mining/miner.js b/lib/mining/miner.js index 2543efc7..74529cd4 100644 --- a/lib/mining/miner.js +++ b/lib/mining/miner.js @@ -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; } diff --git a/lib/node/config.js b/lib/node/config.js index 2457ca21..92d1810b 100644 --- a/lib/node/config.js +++ b/lib/node/config.js @@ -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); diff --git a/lib/node/fullnode.js b/lib/node/fullnode.js index 814930bb..e6048f5b 100644 --- a/lib/node/fullnode.js +++ b/lib/node/fullnode.js @@ -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.