]> Untitled Git - bdk/commit
Replace set_single_recipient with drain_to
authorLLFourn <lloyd.fourn@gmail.com>
Mon, 12 Jul 2021 06:26:29 +0000 (16:26 +1000)
committerLLFourn <lloyd.fourn@gmail.com>
Mon, 12 Jul 2021 06:38:42 +0000 (16:38 +1000)
commit7597645ed6706eb5e3aeed9cadd4746802916ccb
treee6d216f76eb28e84d78d91ba80fabb337bffd7f3
parent618e0d3700d1f3728d3f475cf09cfda70e27b638
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/wallet/mod.rs
src/wallet/tx_builder.rs