commands: check for dust outputs in the PSBT sanity checks

This commit is contained in:
Antoine Poinsot 2022-12-08 16:58:14 +01:00
parent 9f23161a53
commit f2312593da
No known key found for this signature in database
GPG Key ID: E13FC145CD3F4304

View File

@ -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(())
}