Previously, passing multiple --to arguments with --send_all would
silently drain the wallet to only the first recipient, ignoring the
rest. This was inconsistent with the silent-payments create_tx, which
already validates the recipient count.
Now returns an error unless exactly one recipient is provided
page. See [DEVELOPMENT_CYCLE.md](DEVELOPMENT_CYCLE.md) for more details.
## [Unreleased]
+ - Fixed `create_tx --send_all` to reject multiple recipients instead of silently using only the first one
## [3.0.0]
let mut tx_builder = wallet.build_tx();
if send_all {
- tx_builder.drain_wallet().drain_to(recipients[0].0.clone());
+ if recipients.len() == 1 {
+ tx_builder.drain_wallet().drain_to(recipients[0].0.clone());
+ } else {
+ return Err(Error::Generic(
+ "Wallet can only be drained to a single output".to_string(),
+ ));
+ }
} else {
let recipients = recipients
.into_iter()