mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
Merge ElementsProject/elements#1033: Fix another instance of bitcoin #20347 nailing us
2ec356a185wallet: additional patch for https://github.com/bitcoin/bitcoin/issues/20347 (Andrew Poelstra)a3d23c94dewallet: regression test for the previous bugfix (Andrew Poelstra) Pull request description: This is fixed completely upstream in 22.0, but for now we need to patch around it. Discovered while cleaning up the assets tutorial. ACKs for top commit: achow101: ACK2ec356a185Tree-SHA512: 75ef6a0c553ffb09acd692c77303330a10847043de1e60b6cbea071b4989107872481eaeff7ba02e42d87b57c8b770ccf64eb76ae7ed7b547d5d9576945b2ada
This commit is contained in:
commit
e5ac786d7e
2 changed files with 19 additions and 0 deletions
|
|
@ -3775,6 +3775,7 @@ bool CWallet::CreateTransactionInternal(
|
|||
CAmount minimum_value_for_change = GetDustThreshold(change_prototype_txout, discard_rate);
|
||||
if (nFeeRet >= fee_needed_with_change + minimum_value_for_change) {
|
||||
pick_new_inputs = false;
|
||||
one_more_try_20347 = bnb_used;
|
||||
nFeeRet = fee_needed_with_change;
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -480,5 +480,23 @@ class IssuanceTest(BitcoinTestFramework):
|
|||
self.nodes[0].generate(1)
|
||||
assert_equal(self.nodes[0].gettransaction(tx_id)["confirmations"], 1)
|
||||
|
||||
## Regression for one form of https://github.com/bitcoin/bitcoin/issues/20347
|
||||
# 1. Leave node 1 with only a single small explicit output
|
||||
self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), self.nodes[1].getbalance()['bitcoin'], "", "", True)
|
||||
blind_addr = self.nodes[1].getnewaddress()
|
||||
nonblind_addr = self.nodes[1].validateaddress(blind_addr)['unconfidential']
|
||||
self.nodes[0].sendtoaddress(nonblind_addr, 0.0005)
|
||||
self.sync_all()
|
||||
self.nodes[0].generate(2)
|
||||
self.sync_all()
|
||||
|
||||
# 2. Try to do an unblinded issuance with only tokens -- the result will
|
||||
# be an entirely unblinded tx in the 3-output case but a blinded tx
|
||||
# in the 4-output case. As the bug causes us to do coin selection for
|
||||
# the former while attempting to produce the latter, we will trigger
|
||||
# an "impossible" case and a confusing/generic error message.
|
||||
txid = self.nodes[1].issueasset(0, 1, False)["txid"]
|
||||
tx = self.nodes[1].getrawtransaction(txid, True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
IssuanceTest ().main ()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue