]> Untitled Git - bdk-cli/commitdiff
ref(create_tx): enforce single recp for sendall
authorVihiga Tyonum <withtvpeter@gmail.com>
Sat, 4 Jul 2026 10:13:21 +0000 (11:13 +0100)
committerVihiga Tyonum <withtvpeter@gmail.com>
Sat, 4 Jul 2026 10:13:21 +0000 (11:13 +0100)
src/handlers/offline.rs

index b4412301854f1b8d907387cef5a710397abc6c4e..8a7209145d9243a4a1b1b02e14f20310a4f9bea9 100644 (file)
@@ -242,9 +242,15 @@ impl AppCommand<AppContext<OfflineOperations<'_>>> for CreateTxCommand {
         let mut tx_builder = ctx.state.wallet.build_tx();
 
         if self.send_all {
-            tx_builder
-                .drain_wallet()
-                .drain_to(self.recipients[0].0.clone());
+            if self.recipients.len() == 1 {
+                tx_builder
+                    .drain_wallet()
+                    .drain_to(self.recipients[0].0.clone());
+            } else {
+                return Err(Error::Generic(
+                    "Wallet can only be drained to a single output".to_string(),
+                ));
+            }
         } else {
             let recipients = self
                 .recipients