Skip to content

Commit a67b9c3

Browse files
committed
Add anchor CPFP example in psbt test
1 parent 8d957d9 commit a67b9c3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/functional/rpc_psbt.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,18 @@ def test_psbt_input_keys(psbt_input, keys):
889889
anchor_entry = self.nodes[0].getmempoolentry(anchor_txid)
890890
assert_equal(Decimal(anchor_entry["ancestorsize"])/Decimal(10**8), anchor_entry["fees"]["modified"])
891891

892+
# Let's bump it using the wallet via CPFP
893+
anchor_decoded = self.nodes[0].getrawtransaction(anchor_txid, 1)
894+
anchor_index = 0 if anchor_decoded["vout"][0]["value"] == Decimal("0.00000001") else 1
895+
assert self.nodes[0].getbalance() > 0
896+
# 165WU is exactly the size of the input, and the minimum argument value
897+
bump = self.nodes[0].walletcreatefundedpsbt([{"txid": anchor_txid, "vout": anchor_index, "weight": 165}], [{self.nodes[0].getnewaddress(): 1}], 0, {"fee_rate": "10", "add_inputs": True})
898+
bump_signed = self.nodes[0].walletprocesspsbt(bump["psbt"])
899+
bump_final = self.nodes[0].finalizepsbt(bump_signed["psbt"])
900+
cpfp_txid = self.nodes[0].sendrawtransaction(bump_final["hex"])
901+
cpfp_details = self.nodes[0].getmempoolentry(cpfp_txid)
902+
assert_equal(cpfp_details["fees"]["ancestor"], cpfp_details["fees"]["base"] + anchor_entry["fees"]["modified"])
903+
892904
# Check modified fee on node with -ephemeraldelta set
893905
self.nodes[2].sendrawtransaction(anchor_tx)
894906
anchor_entry_2 = self.nodes[2].getmempoolentry(anchor_txid)

0 commit comments

Comments
 (0)