Skip to content

Commit ca10a03

Browse files
instagibbssipa
authored andcommitted
Add basic test for IsStandard witness transaction blinding
1 parent 34521e4 commit ca10a03

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

qa/rpc-tests/p2p-segwit.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -964,8 +964,24 @@ def test_tx_relay_after_segwit_activation(self):
964964

965965
tx3 = CTransaction()
966966
tx3.vin.append(CTxIn(COutPoint(tx2.sha256, 0), b""))
967-
tx3.vout.append(CTxOut(tx2.vout[0].nValue-1000, CScript([OP_TRUE])))
968967
tx3.wit.vtxinwit.append(CTxInWitness())
968+
969+
# Add too-large for IsStandard witness and check that it does not enter reject filter
970+
p2sh_program = CScript([OP_TRUE])
971+
p2sh_pubkey = hash160(p2sh_program)
972+
witness_program2 = CScript([b'a'*400000])
973+
tx3.vout.append(CTxOut(tx2.vout[0].nValue-1000, CScript([OP_HASH160, p2sh_pubkey, OP_EQUAL])))
974+
tx3.wit.vtxinwit[0].scriptWitness.stack = [witness_program2]
975+
tx3.rehash()
976+
977+
# Node will not be blinded to the transaction
978+
self.std_node.announce_tx_and_wait_for_getdata(tx3)
979+
self.std_node.test_transaction_acceptance(tx3, True, False, b'tx-size')
980+
self.std_node.announce_tx_and_wait_for_getdata(tx3)
981+
self.std_node.test_transaction_acceptance(tx3, True, False, b'tx-size')
982+
983+
# Remove witness stuffing, instead add extra witness push on stack
984+
tx3.vout[0] = CTxOut(tx2.vout[0].nValue-1000, CScript([OP_TRUE]))
969985
tx3.wit.vtxinwit[0].scriptWitness.stack = [CScript([CScriptNum(1)]), witness_program ]
970986
tx3.rehash()
971987

0 commit comments

Comments
 (0)