rpc: more accurate client rules handling (gbt).
This commit is contained in:
parent
0a8228b3f4
commit
0120e67203
@ -1514,7 +1514,8 @@ RPC.prototype.getblocktemplate = co(function* getblocktemplate(args) {
|
||||
var mode = 'template';
|
||||
var version = -1;
|
||||
var coinbase = false;
|
||||
var i, opt, lpid, rules, cap, block;
|
||||
var rules = [];
|
||||
var i, opt, lpid, cap, block;
|
||||
var coinbasevalue, coinbasetxn;
|
||||
|
||||
if (args.help || args.length > 1)
|
||||
@ -1541,7 +1542,6 @@ RPC.prototype.getblocktemplate = co(function* getblocktemplate(args) {
|
||||
}
|
||||
|
||||
if (Array.isArray(opt.rules)) {
|
||||
rules = [];
|
||||
for (i = 0; i < opt.rules.length; i++)
|
||||
rules.push(toString(opt.rules[i]));
|
||||
} else if (util.isNumber(opt.maxversion)) {
|
||||
@ -1648,21 +1648,24 @@ RPC.prototype.__template = co(function* _template(version, coinbase, rules) {
|
||||
case common.thresholdStates.LOCKED_IN:
|
||||
block.version |= 1 << deploy.bit;
|
||||
case common.thresholdStates.STARTED:
|
||||
vbavailable[name] = deploy.bit;
|
||||
if (rules) {
|
||||
if (rules.indexOf(name) === -1 && !deploy.force)
|
||||
if (!deploy.force) {
|
||||
if (rules.indexOf(name) === -1)
|
||||
block.version &= ~(1 << deploy.bit);
|
||||
name = '!' + name;
|
||||
}
|
||||
vbavailable[name] = deploy.bit;
|
||||
break;
|
||||
case common.thresholdStates.ACTIVE:
|
||||
if (rules) {
|
||||
if (rules.indexOf(name) === -1 && !deploy.force)
|
||||
if (!deploy.force) {
|
||||
if (rules.indexOf(name) === -1)
|
||||
throw new RPCError('Client must support ' + name + '.');
|
||||
}
|
||||
if (!deploy.force)
|
||||
name = '!' + name;
|
||||
}
|
||||
vbrules.push(name);
|
||||
break;
|
||||
default:
|
||||
assert(false, 'Bad state.');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user