@@ -1418,16 +1418,24 @@ def test_segwit_versions(self):
1418
1418
temp_utxo .pop () # last entry in temp_utxo was the output we just spent
1419
1419
temp_utxo .append (UTXO (tx2 .sha256 , 0 , tx2 .vout [0 ].nValue ))
1420
1420
1421
- # Spend everything in temp_utxo back to an OP_TRUE output.
1421
+ # Spend everything in temp_utxo into an segwit v1 output.
1422
1422
tx3 = CTransaction ()
1423
1423
total_value = 0
1424
1424
for i in temp_utxo :
1425
1425
tx3 .vin .append (CTxIn (COutPoint (i .sha256 , i .n ), b"" ))
1426
1426
tx3 .wit .vtxinwit .append (CTxInWitness ())
1427
1427
total_value += i .nValue
1428
1428
tx3 .wit .vtxinwit [- 1 ].scriptWitness .stack = [witness_program ]
1429
- tx3 .vout .append (CTxOut (total_value - 1000 , CScript ([ OP_TRUE ]) ))
1429
+ tx3 .vout .append (CTxOut (total_value - 1000 , script_pubkey ))
1430
1430
tx3 .rehash ()
1431
+
1432
+ # First we test this transaction against fRequireStandard=true node
1433
+ # making sure the txid is added to the reject filter
1434
+ self .std_node .announce_tx_and_wait_for_getdata (tx3 )
1435
+ test_transaction_acceptance (self .nodes [1 ], self .std_node , tx3 , with_witness = True , accepted = False , reason = "bad-txns-nonstandard-inputs" )
1436
+ # Now the node will no longer ask for getdata of this transaction when advertised by same txid
1437
+ self .std_node .announce_tx_and_wait_for_getdata (tx3 , timeout = 5 , success = False )
1438
+
1431
1439
# Spending a higher version witness output is not allowed by policy,
1432
1440
# even with fRequireStandard=false.
1433
1441
test_transaction_acceptance (self .nodes [0 ], self .test_node , tx3 , with_witness = True , accepted = False , reason = "reserved for soft-fork upgrades" )
0 commit comments