blockchain: enable segwit for regtest
This commit is contained in:
parent
b10aea8f3d
commit
fa877503a4
@ -2389,6 +2389,9 @@ class Chain extends AsyncEmitter {
|
|||||||
async getState(prev, deployment) {
|
async getState(prev, deployment) {
|
||||||
const bit = deployment.bit;
|
const bit = deployment.bit;
|
||||||
|
|
||||||
|
if (deployment.startTime === -1)
|
||||||
|
return thresholdStates.ACTIVE;
|
||||||
|
|
||||||
let window = this.network.minerWindow;
|
let window = this.network.minerWindow;
|
||||||
let threshold = this.network.activationThreshold;
|
let threshold = this.network.activationThreshold;
|
||||||
|
|
||||||
|
|||||||
@ -639,13 +639,13 @@ class ChainDB {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
writeDeployments(b) {
|
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);
|
bw.writeU8(this.network.deploys.length);
|
||||||
|
|
||||||
for (const deployment of this.network.deploys) {
|
for (const deployment of this.network.deploys) {
|
||||||
bw.writeU8(deployment.bit);
|
bw.writeU8(deployment.bit);
|
||||||
bw.writeU32(deployment.startTime);
|
bw.writeI64(deployment.startTime);
|
||||||
bw.writeU32(deployment.timeout);
|
bw.writeU32(deployment.timeout);
|
||||||
bw.writeI32(deployment.threshold);
|
bw.writeI32(deployment.threshold);
|
||||||
bw.writeI32(deployment.window);
|
bw.writeI32(deployment.window);
|
||||||
@ -671,7 +671,7 @@ class ChainDB {
|
|||||||
|
|
||||||
for (let i = 0; i < count; i++) {
|
for (let i = 0; i < count; i++) {
|
||||||
const bit = br.readU8();
|
const bit = br.readU8();
|
||||||
const start = br.readU32();
|
const start = br.readI64();
|
||||||
const timeout = br.readU32();
|
const timeout = br.readU32();
|
||||||
const threshold = br.readI32();
|
const threshold = br.readI32();
|
||||||
const window = br.readI32();
|
const window = br.readI32();
|
||||||
|
|||||||
@ -801,7 +801,7 @@ regtest.deployments = {
|
|||||||
segwit: {
|
segwit: {
|
||||||
name: 'segwit',
|
name: 'segwit',
|
||||||
bit: 1,
|
bit: 1,
|
||||||
startTime: 0,
|
startTime: -1,
|
||||||
timeout: 0xffffffff,
|
timeout: 0xffffffff,
|
||||||
threshold: -1,
|
threshold: -1,
|
||||||
window: -1,
|
window: -1,
|
||||||
|
|||||||
@ -203,12 +203,14 @@ describe('HTTP', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should get a block template', async () => {
|
it('should get a block template', async () => {
|
||||||
const json = await nclient.execute('getblocktemplate', []);
|
const json = await nclient.execute('getblocktemplate', [{
|
||||||
|
rules: ['segwit']
|
||||||
|
}]);
|
||||||
assert.deepStrictEqual(json, {
|
assert.deepStrictEqual(json, {
|
||||||
capabilities: ['proposal'],
|
capabilities: ['proposal'],
|
||||||
mutable: ['time', 'transactions', 'prevblock'],
|
mutable: ['time', 'transactions', 'prevblock'],
|
||||||
version: 536870912,
|
version: 536870912,
|
||||||
rules: [],
|
rules: ['!segwit'],
|
||||||
vbavailable: {},
|
vbavailable: {},
|
||||||
vbrequired: 0,
|
vbrequired: 0,
|
||||||
height: 1,
|
height: 1,
|
||||||
@ -222,15 +224,19 @@ describe('HTTP', function() {
|
|||||||
mintime: 1296688603,
|
mintime: 1296688603,
|
||||||
maxtime: json.maxtime,
|
maxtime: json.maxtime,
|
||||||
expires: json.expires,
|
expires: json.expires,
|
||||||
sigoplimit: 20000,
|
sigoplimit: 80000,
|
||||||
sizelimit: 1000000,
|
sizelimit: 4000000,
|
||||||
|
weightlimit: 4000000,
|
||||||
longpollid:
|
longpollid:
|
||||||
'0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206'
|
'0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206'
|
||||||
+ '00000000',
|
+ '00000000',
|
||||||
submitold: false,
|
submitold: false,
|
||||||
coinbaseaux: { flags: '6d696e65642062792062636f696e' },
|
coinbaseaux: { flags: '6d696e65642062792062636f696e' },
|
||||||
coinbasevalue: 5000000000,
|
coinbasevalue: 5000000000,
|
||||||
transactions: []
|
transactions: [],
|
||||||
|
default_witness_commitment:
|
||||||
|
'6a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48beb'
|
||||||
|
+ 'd836974e8cf9'
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user