(self, rbf_node, dest_address)
| 563 | |
| 564 | |
| 565 | def test_change_script_match(self, rbf_node, dest_address): |
| 566 | self.log.info('Test that the same change addresses is used for the replacement transaction when possible') |
| 567 | |
| 568 | def get_change_address(tx): |
| 569 | tx_details = rbf_node.getrawtransaction(tx, 1) |
| 570 | txout_addresses = [txout['scriptPubKey']['address'] for txout in tx_details["vout"] if txout['scriptPubKey']['type'] != 'fee'] |
| 571 | return [address for address in txout_addresses if rbf_node.getaddressinfo(address)["ischange"]] |
| 572 | |
| 573 | # Check that there is only one change output |
| 574 | rbfid = spend_one_input(rbf_node, dest_address) |
| 575 | change_addresses = get_change_address(rbfid) |
| 576 | assert_equal(len(change_addresses), 1) |
| 577 | |
| 578 | # Now find that address in each subsequent tx, and no other change |
| 579 | bumped_total_tx = rbf_node.bumpfee(rbfid, {"fee_rate": ECONOMICAL}) |
| 580 | assert_equal(change_addresses, get_change_address(bumped_total_tx['txid'])) |
| 581 | bumped_rate_tx = rbf_node.bumpfee(bumped_total_tx["txid"]) |
| 582 | assert_equal(change_addresses, get_change_address(bumped_rate_tx['txid'])) |
| 583 | self.clear_mempool() |
| 584 | |
| 585 | |
| 586 | def spend_one_input(node, dest_address, change_size=Decimal("0.00049000")): |
no test coverage detected