Skip to content

Commit 4ced5de

Browse files
committed
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)
2 parents 7e9ab95 + 5547aeb commit 4ced5de

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

qa/rpc-tests/p2p-segwit.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,13 +305,18 @@ def test_unnecessary_witness_before_segwit_activation(self):
305305
sync_blocks(self.nodes)
306306

307307
# We'll add an unnecessary witness to this transaction that would cause
308-
# it to be too large according to IsStandard.
308+
# it to be non-standard, to test that violating policy with a witness before
309+
# segwit activation doesn't blind a node to a transaction. Transactions
310+
# rejected for having a witness before segwit activation shouldn't be added
311+
# to the rejection cache.
309312
tx3 = CTransaction()
310313
tx3.vin.append(CTxIn(COutPoint(tx2.sha256, 0), CScript([p2sh_program])))
311314
tx3.vout.append(CTxOut(tx2.vout[0].nValue-1000, scriptPubKey))
312315
tx3.wit.vtxinwit.append(CTxInWitness())
313316
tx3.wit.vtxinwit[0].scriptWitness.stack = [b'a'*400000]
314317
tx3.rehash()
318+
# Note that this should be rejected for the premature witness reason,
319+
# rather than a policy check, since segwit hasn't activated yet.
315320
self.std_node.test_transaction_acceptance(tx3, True, False, b'no-witness-yet')
316321

317322
# If we send without witness, it should be accepted.
@@ -949,8 +954,7 @@ def test_tx_relay_after_segwit_activation(self):
949954
self.test_node.test_transaction_acceptance(tx, with_witness=True, accepted=False)
950955

951956
# Verify that removing the witness succeeds.
952-
# Re-announcing won't result in a getdata for ~2.5 minutes, so just
953-
# deliver the modified transaction.
957+
self.test_node.announce_tx_and_wait_for_getdata(tx)
954958
self.test_node.test_transaction_acceptance(tx, with_witness=False, accepted=True)
955959

956960
# Now try to add extra witness data to a valid witness tx.

0 commit comments

Comments
 (0)