X Tutup
Skip to content

Commit 52c3bec

Browse files
instagibbssdaftuar
authored andcommitted
test addition of unknown segwit spends to txid reject filter
Github-Pull: bitcoin#19620 Rebased-From: 9f88ded
1 parent 2ea826c commit 52c3bec

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

test/functional/p2p_segwit.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,16 +1391,24 @@ def test_segwit_versions(self):
13911391
temp_utxo.pop() # last entry in temp_utxo was the output we just spent
13921392
temp_utxo.append(UTXO(tx2.sha256, 0, tx2.vout[0].nValue))
13931393

1394-
# Spend everything in temp_utxo back to an OP_TRUE output.
1394+
# Spend everything in temp_utxo into an segwit v1 output.
13951395
tx3 = CTransaction()
13961396
total_value = 0
13971397
for i in temp_utxo:
13981398
tx3.vin.append(CTxIn(COutPoint(i.sha256, i.n), b""))
13991399
tx3.wit.vtxinwit.append(CTxInWitness())
14001400
total_value += i.nValue
14011401
tx3.wit.vtxinwit[-1].scriptWitness.stack = [witness_program]
1402-
tx3.vout.append(CTxOut(total_value - 1000, CScript([OP_TRUE])))
1402+
tx3.vout.append(CTxOut(total_value - 1000, script_pubkey))
14031403
tx3.rehash()
1404+
1405+
# First we test this transaction against fRequireStandard=true node
1406+
# making sure the txid is added to the reject filter
1407+
self.std_node.announce_tx_and_wait_for_getdata(tx3)
1408+
test_transaction_acceptance(self.nodes[1], self.std_node, tx3, with_witness=True, accepted=False, reason="bad-txns-nonstandard-inputs")
1409+
# Now the node will no longer ask for getdata of this transaction when advertised by same txid
1410+
self.std_node.announce_tx_and_wait_for_getdata(tx3, timeout=5, success=False)
1411+
14041412
# Spending a higher version witness output is not allowed by policy,
14051413
# even with fRequireStandard=false.
14061414
test_transaction_acceptance(self.nodes[0], self.test_node, tx3, with_witness=True, accepted=False, reason="reserved for soft-fork upgrades")

0 commit comments

Comments
 (0)
X Tutup