From 50d248cfc482bf5d7807b84182e7f19b104ab49b Mon Sep 17 00:00:00 2001 From: Artemiy Date: Sun, 21 Jun 2026 10:11:17 +0300 Subject: [PATCH] fix(create_tx): enforce single recipient for send_all 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 --- CHANGELOG.md | 1 + src/handlers.rs | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e66f84c..3fc8b4fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ Changelog info is also documented on the [GitHub releases](https://github.com/bi 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] diff --git a/src/handlers.rs b/src/handlers.rs index 15a4d5ac..398f612a 100644 --- a/src/handlers.rs +++ b/src/handlers.rs @@ -540,7 +540,13 @@ pub fn handle_offline_wallet_subcommand( 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()