wallet: regression test for the previous bugfix

This commit is contained in:
Andrew Poelstra 2021-09-06 20:05:07 +00:00
parent 904054ffcb
commit a3d23c94de

View file

@ -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 ()