mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-04 10:12:28 +02:00
Amend bumpfee for inputs with overlapping ancestry
At the end of coin selection reduce the fees by the difference between the individual bump fee estimates and the collective bump fee estimate.
This commit is contained in:
@@ -337,6 +337,28 @@ class UnconfirmedInputTest(BitcoinTestFramework):
|
||||
|
||||
wallet.unloadwallet()
|
||||
|
||||
# Test that transaction spending two UTXOs with overlapping ancestry does not bump shared ancestors twice
|
||||
def test_target_feerate_unconfirmed_low_overlapping_ancestry(self):
|
||||
self.log.info("Start test where two UTXOs have overlapping ancestry")
|
||||
wallet = self.setup_and_fund_wallet("overlapping_ancestry_wallet")
|
||||
|
||||
parent_txid = wallet.sendtoaddress(address=wallet.getnewaddress(), amount=1, fee_rate=1)
|
||||
two_output_parent_tx = wallet.gettransaction(txid=parent_txid, verbose=True)
|
||||
|
||||
self.assert_undershoots_target(two_output_parent_tx)
|
||||
|
||||
# spend both outputs from parent transaction
|
||||
ancestor_aware_txid = wallet.sendtoaddress(address=self.def_wallet.getnewaddress(), amount=1.5, fee_rate=self.target_fee_rate)
|
||||
ancestor_aware_tx = wallet.gettransaction(txid=ancestor_aware_txid, verbose=True)
|
||||
self.assert_spends_only_parents(ancestor_aware_tx, [parent_txid, parent_txid])
|
||||
|
||||
self.assert_beats_target(ancestor_aware_tx)
|
||||
resulting_ancestry_fee_rate = self.calc_set_fee_rate([two_output_parent_tx, ancestor_aware_tx])
|
||||
assert_greater_than_or_equal(resulting_ancestry_fee_rate, self.target_fee_rate)
|
||||
assert_greater_than_or_equal(self.target_fee_rate*1.01, resulting_ancestry_fee_rate)
|
||||
|
||||
wallet.unloadwallet()
|
||||
|
||||
# Test that new transaction ignores sibling transaction with low feerate
|
||||
def test_sibling_tx_gets_ignored(self):
|
||||
self.log.info("Start test where a low-fee sibling tx gets created and check that bumping ignores it")
|
||||
@@ -472,6 +494,8 @@ class UnconfirmedInputTest(BitcoinTestFramework):
|
||||
|
||||
self.test_rbf_bumping()
|
||||
|
||||
self.test_target_feerate_unconfirmed_low_overlapping_ancestry()
|
||||
|
||||
self.test_sibling_tx_gets_ignored()
|
||||
|
||||
self.test_sibling_tx_bumps_parent()
|
||||
|
||||
Reference in New Issue
Block a user