Skip to content

Commit b8f498f

Browse files
author
MarcoFalke
committed
Merge bitcoin/bitcoin#24535: test: Fix generate calls and comments in feature_segwit
fa8593f test: Fix generate calls and comments in feature_segwit (MarcoFalke) Pull request description: There are currently a few incorrect comments: Block `432` is mined "twice" (The second one is actually 433). There isn't any need to mine this many blocks anyway, so remove a few calls. ACKs for top commit: theStack: Tested ACK fa8593f Tree-SHA512: b034077b85e6c978a80aa4de493797b4ae451d686cfb3e4fe40f37a38f41f7cb886f8e00a1c245a284be3502164b17414097fcb0bef66d155a1c1db5cfbe9e8f
2 parents e3206c9 + fa8593f commit b8f498f

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

test/functional/feature_segwit.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -86,18 +86,18 @@ def set_test_params(self):
8686
[
8787
"-acceptnonstdtxn=1",
8888
"-rpcserialversion=0",
89-
"-testactivationheight=segwit@432",
89+
"-testactivationheight=segwit@165",
9090
"-addresstype=legacy",
9191
],
9292
[
9393
"-acceptnonstdtxn=1",
9494
"-rpcserialversion=1",
95-
"-testactivationheight=segwit@432",
95+
"-testactivationheight=segwit@165",
9696
"-addresstype=legacy",
9797
],
9898
[
9999
"-acceptnonstdtxn=1",
100-
"-testactivationheight=segwit@432",
100+
"-testactivationheight=segwit@165",
101101
"-addresstype=legacy",
102102
],
103103
]
@@ -191,13 +191,11 @@ def run_test(self):
191191
assert_equal(self.nodes[1].getbalance(), 20 * Decimal("49.999"))
192192
assert_equal(self.nodes[2].getbalance(), 20 * Decimal("49.999"))
193193

194-
self.generate(self.nodes[0], 264) # block 427
195-
196194
self.log.info("Verify unsigned p2sh witness txs without a redeem script are invalid")
197195
self.fail_accept(self.nodes[2], "mandatory-script-verify-flag-failed (Operation not valid with the current stack size)", p2sh_ids[NODE_2][P2WPKH][1], sign=False)
198196
self.fail_accept(self.nodes[2], "mandatory-script-verify-flag-failed (Operation not valid with the current stack size)", p2sh_ids[NODE_2][P2WSH][1], sign=False)
199197

200-
self.generate(self.nodes[0], 4) # blocks 428-431
198+
self.generate(self.nodes[0], 1) # block 164
201199

202200
self.log.info("Verify witness txs are mined as soon as segwit activates")
203201

@@ -207,7 +205,7 @@ def run_test(self):
207205
send_to_witness(1, self.nodes[2], getutxo(p2sh_ids[NODE_2][P2WSH][0]), self.pubkey[0], encode_p2sh=False, amount=Decimal("49.998"), sign=True)
208206

209207
assert_equal(len(self.nodes[2].getrawmempool()), 4)
210-
blockhash = self.generate(self.nodes[2], 1)[0] # block 432 (first block with new rules; 432 = 144 * 3)
208+
blockhash = self.generate(self.nodes[2], 1)[0] # block 165 (first block with new rules)
211209
assert_equal(len(self.nodes[2].getrawmempool()), 0)
212210
segwit_tx_list = self.nodes[2].getblock(blockhash)["tx"]
213211
assert_equal(len(segwit_tx_list), 5)
@@ -249,10 +247,10 @@ def run_test(self):
249247
self.fail_accept(self.nodes[2], 'non-mandatory-script-verify-flag (Witness program was passed an empty witness)', p2sh_ids[NODE_2][P2WSH][2], sign=False, redeem_script=witness_script(True, self.pubkey[2]))
250248

251249
self.log.info("Verify default node can now use witness txs")
252-
self.success_mine(self.nodes[0], wit_ids[NODE_0][P2WPKH][0], True) # block 432
253-
self.success_mine(self.nodes[0], wit_ids[NODE_0][P2WSH][0], True) # block 433
254-
self.success_mine(self.nodes[0], p2sh_ids[NODE_0][P2WPKH][0], True) # block 434
255-
self.success_mine(self.nodes[0], p2sh_ids[NODE_0][P2WSH][0], True) # block 435
250+
self.success_mine(self.nodes[0], wit_ids[NODE_0][P2WPKH][0], True)
251+
self.success_mine(self.nodes[0], wit_ids[NODE_0][P2WSH][0], True)
252+
self.success_mine(self.nodes[0], p2sh_ids[NODE_0][P2WPKH][0], True)
253+
self.success_mine(self.nodes[0], p2sh_ids[NODE_0][P2WSH][0], True)
256254

257255
self.log.info("Verify sigops are counted in GBT with BIP141 rules after the fork")
258256
txid = self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), 1)

0 commit comments

Comments
 (0)