Browse Source

Merge #8528: Update p2p-segwit.py to reflect correct behavior

5547aeb p2psegwit.py transaction is rejected due to premature witness not size (instagibbs)
bc1d1f2 Update p2p-segwit.py to reflect correct AskFor behavior (instagibbs)
0.14
Wladimir J. van der Laan 8 years ago
parent
commit
4ced5de71d
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 10
      qa/rpc-tests/p2p-segwit.py

10
qa/rpc-tests/p2p-segwit.py

@ -305,13 +305,18 @@ class SegWitTest(BitcoinTestFramework):
sync_blocks(self.nodes) sync_blocks(self.nodes)
# We'll add an unnecessary witness to this transaction that would cause # We'll add an unnecessary witness to this transaction that would cause
# it to be too large according to IsStandard. # it to be non-standard, to test that violating policy with a witness before
# segwit activation doesn't blind a node to a transaction. Transactions
# rejected for having a witness before segwit activation shouldn't be added
# to the rejection cache.
tx3 = CTransaction() tx3 = CTransaction()
tx3.vin.append(CTxIn(COutPoint(tx2.sha256, 0), CScript([p2sh_program]))) tx3.vin.append(CTxIn(COutPoint(tx2.sha256, 0), CScript([p2sh_program])))
tx3.vout.append(CTxOut(tx2.vout[0].nValue-1000, scriptPubKey)) tx3.vout.append(CTxOut(tx2.vout[0].nValue-1000, scriptPubKey))
tx3.wit.vtxinwit.append(CTxInWitness()) tx3.wit.vtxinwit.append(CTxInWitness())
tx3.wit.vtxinwit[0].scriptWitness.stack = [b'a'*400000] tx3.wit.vtxinwit[0].scriptWitness.stack = [b'a'*400000]
tx3.rehash() tx3.rehash()
# Note that this should be rejected for the premature witness reason,
# rather than a policy check, since segwit hasn't activated yet.
self.std_node.test_transaction_acceptance(tx3, True, False, b'no-witness-yet') self.std_node.test_transaction_acceptance(tx3, True, False, b'no-witness-yet')
# If we send without witness, it should be accepted. # If we send without witness, it should be accepted.
@ -949,8 +954,7 @@ class SegWitTest(BitcoinTestFramework):
self.test_node.test_transaction_acceptance(tx, with_witness=True, accepted=False) self.test_node.test_transaction_acceptance(tx, with_witness=True, accepted=False)
# Verify that removing the witness succeeds. # Verify that removing the witness succeeds.
# Re-announcing won't result in a getdata for ~2.5 minutes, so just self.test_node.announce_tx_and_wait_for_getdata(tx)
# deliver the modified transaction.
self.test_node.test_transaction_acceptance(tx, with_witness=False, accepted=True) self.test_node.test_transaction_acceptance(tx, with_witness=False, accepted=True)
# Now try to add extra witness data to a valid witness tx. # Now try to add extra witness data to a valid witness tx.

Loading…
Cancel
Save