aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Sanders <gsanders87@gmail.com>2020-08-03 14:37:58 -0400
committerSuhas Daftuar <sdaftuar@gmail.com>2020-08-11 10:27:39 -0400
commit52c3bec1bad4fc602a3911b44de48c6b0dbdfd25 (patch)
tree712cf5da762da6e2899628a4e5e51df2ae79ca73
parent2ea826cfc46ee8edfca059d0fd95ebe03122f9f2 (diff)
downloadbitcoin-52c3bec1bad4fc602a3911b44de48c6b0dbdfd25.tar.xz
test addition of unknown segwit spends to txid reject filter
Github-Pull: #19620 Rebased-From: 9f88ded82b2898ca63d44c08072f1ba52f0e18d7
-rwxr-xr-xtest/functional/p2p_segwit.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/test/functional/p2p_segwit.py b/test/functional/p2p_segwit.py
index 98f6b1d71d..760cedde3a 100755
--- a/test/functional/p2p_segwit.py
+++ b/test/functional/p2p_segwit.py
@@ -1391,7 +1391,7 @@ class SegWitTest(BitcoinTestFramework):
temp_utxo.pop() # last entry in temp_utxo was the output we just spent
temp_utxo.append(UTXO(tx2.sha256, 0, tx2.vout[0].nValue))
- # Spend everything in temp_utxo back to an OP_TRUE output.
+ # Spend everything in temp_utxo into an segwit v1 output.
tx3 = CTransaction()
total_value = 0
for i in temp_utxo:
@@ -1399,8 +1399,16 @@ class SegWitTest(BitcoinTestFramework):
tx3.wit.vtxinwit.append(CTxInWitness())
total_value += i.nValue
tx3.wit.vtxinwit[-1].scriptWitness.stack = [witness_program]
- tx3.vout.append(CTxOut(total_value - 1000, CScript([OP_TRUE])))
+ tx3.vout.append(CTxOut(total_value - 1000, script_pubkey))
tx3.rehash()
+
+ # First we test this transaction against fRequireStandard=true node
+ # making sure the txid is added to the reject filter
+ self.std_node.announce_tx_and_wait_for_getdata(tx3)
+ test_transaction_acceptance(self.nodes[1], self.std_node, tx3, with_witness=True, accepted=False, reason="bad-txns-nonstandard-inputs")
+ # Now the node will no longer ask for getdata of this transaction when advertised by same txid
+ self.std_node.announce_tx_and_wait_for_getdata(tx3, timeout=5, success=False)
+
# Spending a higher version witness output is not allowed by policy,
# even with fRequireStandard=false.
test_transaction_acceptance(self.nodes[0], self.test_node, tx3, with_witness=True, accepted=False, reason="reserved for soft-fork upgrades")