Skip to content

Commit 1afa3c8

Browse files
committed
Merge bitcoin/bitcoin#30562: PayToAnchor(P2A) followups
2a3a242 test: check that P2A with witness data is still consensus-legal (Greg Sanders) 68bd86c test: P2A is a destination type with an address (Greg Sanders) Pull request description: Followups for bitcoin/bitcoin#30352 Suggestions taken: bitcoin/bitcoin#30352 (comment) bitcoin/bitcoin#30352 (comment) ACKs for top commit: tdb3: ACK 2a3a242 glozow: ACK 2a3a242 theStack: ACK 2a3a242 Tree-SHA512: 5de865b2c300fa504dbdbd5879649a6fc328da052ad8bf9479e3fea0c49c516d824908a87523ec1fb30cc536bffe2e116dd523a9b66a07f81f93429e42879f14
2 parents f0d0855 + 2a3a242 commit 1afa3c8

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

test/functional/mempool_accept.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -409,10 +409,19 @@ def run_test(self):
409409
maxfeerate=0,
410410
)
411411

412-
# Clear witness stuffing
413-
anchor_spend = anchor_nonempty_wit_spend
414-
anchor_spend.wit.vtxinwit[0].scriptWitness.stack = []
415-
anchor_spend.rehash()
412+
# but is consensus-legal
413+
self.generateblock(node, self.wallet.get_address(), [anchor_nonempty_wit_spend.serialize().hex()])
414+
415+
# Without witness elements it is standard
416+
create_anchor_tx = self.wallet.send_to(from_node=node, scriptPubKey=PAY_TO_ANCHOR, amount=anchor_value)
417+
self.generate(node, 1)
418+
419+
anchor_spend = CTransaction()
420+
anchor_spend.vin.append(CTxIn(COutPoint(int(create_anchor_tx["txid"], 16), create_anchor_tx["sent_vout"]), b""))
421+
anchor_spend.vout.append(CTxOut(anchor_value - int(fee*COIN), script_to_p2wsh_script(CScript([OP_TRUE]))))
422+
anchor_spend.wit.vtxinwit.append(CTxInWitness())
423+
# It's "segwit" but txid == wtxid since there is no witness data
424+
assert_equal(anchor_spend.rehash(), anchor_spend.getwtxid())
416425

417426
self.check_mempool_result(
418427
result_expected=[{'txid': anchor_spend.rehash(), 'allowed': True, 'vsize': anchor_spend.get_vsize(), 'fees': { 'base': Decimal('0.00000700')}}],

test/functional/rpc_validateaddress.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,11 @@
166166
"bc1p0xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7vqzk5jj0",
167167
"512079be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",
168168
),
169+
# PayToAnchor(P2A)
170+
(
171+
"bc1pfeessrawgf",
172+
"51024e73",
173+
),
169174
]
170175

171176

0 commit comments

Comments
 (0)