aboutsummaryrefslogtreecommitdiff
path: root/test/functional/feature_segwit.py
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2022-03-18 14:13:58 +0100
committerMarcoFalke <falke.marco@gmail.com>2022-03-18 14:14:06 +0100
commit66e2d21ef203e422eea8f0a3c7029ac59b210668 (patch)
tree57d3563258e6386769c72535ccb38ef92ed489ca /test/functional/feature_segwit.py
parenta7b3123feadbbd3447d102f1c4e84631f7434092 (diff)
parentd6b24e14d2a828ba7328f0cae1d0d7c5f4f6b3bd (diff)
downloadbitcoin-66e2d21ef203e422eea8f0a3c7029ac59b210668.tar.xz
Merge bitcoin/bitcoin#24578: test: Fix intermittent failure in feature_segwit
d6b24e14d2a828ba7328f0cae1d0d7c5f4f6b3bd test: Fix intermittent failure in feature_segwit (DrahtBot) Pull request description: There are intermittent failures on current master (https://github.com/bitcoin/bitcoin/pull/24421#issuecomment-1067451667) as the witness txs occasionally make it into other node's mempools when they shouldn't. Fix this by removing the test as suggested earlier in https://github.com/bitcoin/bitcoin/pull/24421#discussion_r822933721. Fixes https://github.com/bitcoin/bitcoin/issues/24590 ACKs for top commit: aureleoules: tACK d6b24e14d2a828ba7328f0cae1d0d7c5f4f6b3bd. jnewbery: Code review ACK d6b24e14d2a828ba7328f0cae1d0d7c5f4f6b3bd Tree-SHA512: ef7be52bdbde97b6921b44824e7fbc2dd92b77b8f076794867259f2b0bff08e0def06f4b2576f63a8ccb737a15cd8441fb7db20fa1f0d4fa9c7c76d5b83388ef
Diffstat (limited to 'test/functional/feature_segwit.py')
-rwxr-xr-xtest/functional/feature_segwit.py18
1 files changed, 7 insertions, 11 deletions
diff --git a/test/functional/feature_segwit.py b/test/functional/feature_segwit.py
index 50adc08d9a..6fdac8ece9 100755
--- a/test/functional/feature_segwit.py
+++ b/test/functional/feature_segwit.py
@@ -117,10 +117,6 @@ class SegWitTest(BitcoinTestFramework):
assert_equal(len(node.getblock(block[0])["tx"]), 2)
self.sync_blocks()
- def fail_mine(self, node, txid, sign, redeem_script=""):
- send_to_witness(1, node, getutxo(txid), self.pubkey[0], False, Decimal("49.998"), sign, redeem_script)
- assert_raises_rpc_error(-1, "unexpected witness data found", self.generate, node, 1)
-
def fail_accept(self, node, error_msg, txid, sign, redeem_script=""):
assert_raises_rpc_error(-26, error_msg, send_to_witness, use_p2wsh=1, node=node, utxo=getutxo(txid), pubkey=self.pubkey[0], encode_p2sh=False, amount=Decimal("49.998"), sign=sign, insert_redeem_script=redeem_script)
@@ -197,19 +193,19 @@ class SegWitTest(BitcoinTestFramework):
self.generate(self.nodes[0], 264) # block 427
- self.log.info("Verify witness txs cannot be mined before the fork")
- self.fail_mine(self.nodes[2], wit_ids[NODE_2][P2WPKH][0], True)
- self.fail_mine(self.nodes[2], wit_ids[NODE_2][P2WSH][0], True)
- self.fail_mine(self.nodes[2], p2sh_ids[NODE_2][P2WPKH][0], True)
- self.fail_mine(self.nodes[2], p2sh_ids[NODE_2][P2WSH][0], True)
-
self.log.info("Verify unsigned p2sh witness txs without a redeem script are invalid")
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)
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)
self.generate(self.nodes[0], 4) # blocks 428-431
- self.log.info("Verify previous witness txs can now be mined")
+ self.log.info("Verify witness txs are mined as soon as segwit activates")
+
+ send_to_witness(1, self.nodes[2], getutxo(wit_ids[NODE_2][P2WPKH][0]), self.pubkey[0], encode_p2sh=False, amount=Decimal("49.998"), sign=True)
+ send_to_witness(1, self.nodes[2], getutxo(wit_ids[NODE_2][P2WSH][0]), self.pubkey[0], encode_p2sh=False, amount=Decimal("49.998"), sign=True)
+ send_to_witness(1, self.nodes[2], getutxo(p2sh_ids[NODE_2][P2WPKH][0]), self.pubkey[0], encode_p2sh=False, amount=Decimal("49.998"), sign=True)
+ 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)
+
assert_equal(len(self.nodes[2].getrawmempool()), 4)
blockhash = self.generate(self.nodes[2], 1)[0] # block 432 (first block with new rules; 432 = 144 * 3)
assert_equal(len(self.nodes[2].getrawmempool()), 0)