]> Untitled Git - bdk/commit
Replace set_single_recipient with drain_to
authorLLFourn <lloyd.fourn@gmail.com>
Wed, 16 Jun 2021 02:43:32 +0000 (12:43 +1000)
committerLLFourn <lloyd.fourn@gmail.com>
Mon, 12 Jul 2021 06:21:53 +0000 (16:21 +1000)
commit618e0d3700d1f3728d3f475cf09cfda70e27b638
treec9b3c9fb1d12a6c4908c0e2e887c841b9cad0352
parentc1077b95cf432ce1583713fe54fb36915c99a35f
Replace set_single_recipient with drain_to

What set_single_recipient does turns out to be useful with multiple
recipients.
Effectively, set_single_recipient was simply creating a change
output that was arbitrarily required to be the only output.
But what if you want to send excess funds to one address but still have
additional recipients who receive a fixed value?
Generalizing this to `drain_to` simplifies the logic and removes several
error cases while also allowing new use cases.

"maintain_single_recipient" is also replaced with "allow_shrinking"
which has more general semantics.
CHANGELOG.md
src/error.rs
src/wallet/mod.rs
src/wallet/tx_builder.rs