blockchain: enable segwit for regtest

This commit is contained in:
Braydon Fuller 2019-01-31 13:02:40 -08:00
parent b10aea8f3d
commit fa877503a4
No known key found for this signature in database
GPG Key ID: F24F232D108B3AD4
4 changed files with 18 additions and 9 deletions

View File

@ -2389,6 +2389,9 @@ class Chain extends AsyncEmitter {
async getState(prev, deployment) {
const bit = deployment.bit;
if (deployment.startTime === -1)
return thresholdStates.ACTIVE;
let window = this.network.minerWindow;
let threshold = this.network.activationThreshold;

View File

@ -639,13 +639,13 @@ class ChainDB {
*/
writeDeployments(b) {
const bw = bio.write(1 + 17 * this.network.deploys.length);
const bw = bio.write(1 + 21 * this.network.deploys.length);
bw.writeU8(this.network.deploys.length);
for (const deployment of this.network.deploys) {
bw.writeU8(deployment.bit);
bw.writeU32(deployment.startTime);
bw.writeI64(deployment.startTime);
bw.writeU32(deployment.timeout);
bw.writeI32(deployment.threshold);
bw.writeI32(deployment.window);
@ -671,7 +671,7 @@ class ChainDB {
for (let i = 0; i < count; i++) {
const bit = br.readU8();
const start = br.readU32();
const start = br.readI64();
const timeout = br.readU32();
const threshold = br.readI32();
const window = br.readI32();

View File

@ -801,7 +801,7 @@ regtest.deployments = {
segwit: {
name: 'segwit',
bit: 1,
startTime: 0,
startTime: -1,
timeout: 0xffffffff,
threshold: -1,
window: -1,

View File

@ -203,12 +203,14 @@ describe('HTTP', function() {
});
it('should get a block template', async () => {
const json = await nclient.execute('getblocktemplate', []);
const json = await nclient.execute('getblocktemplate', [{
rules: ['segwit']
}]);
assert.deepStrictEqual(json, {
capabilities: ['proposal'],
mutable: ['time', 'transactions', 'prevblock'],
version: 536870912,
rules: [],
rules: ['!segwit'],
vbavailable: {},
vbrequired: 0,
height: 1,
@ -222,15 +224,19 @@ describe('HTTP', function() {
mintime: 1296688603,
maxtime: json.maxtime,
expires: json.expires,
sigoplimit: 20000,
sizelimit: 1000000,
sigoplimit: 80000,
sizelimit: 4000000,
weightlimit: 4000000,
longpollid:
'0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206'
+ '00000000',
submitold: false,
coinbaseaux: { flags: '6d696e65642062792062636f696e' },
coinbasevalue: 5000000000,
transactions: []
transactions: [],
default_witness_commitment:
'6a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48beb'
+ 'd836974e8cf9'
});
});