From f2312593da8b27c6c6a69c7b0463959369c5acb6 Mon Sep 17 00:00:00 2001 From: Antoine Poinsot Date: Thu, 8 Dec 2022 16:58:14 +0100 Subject: [PATCH] commands: check for dust outputs in the PSBT sanity checks --- src/commands/mod.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/commands/mod.rs b/src/commands/mod.rs index 890da887..05183ea0 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -162,6 +162,13 @@ fn sanity_check_psbt(psbt: &Psbt) -> Result<(), CommandError> { return Err(CommandError::SanityCheckFailure(psbt.clone())); } + // Check for dust outputs + for txo in psbt.unsigned_tx.output.iter() { + if txo.value < txo.script_pubkey.dust_value().to_sat() { + return Err(CommandError::SanityCheckFailure(psbt.clone())); + } + } + Ok(()) }