diff --git a/src/commands/mod.rs b/src/commands/mod.rs index 08ee7b90..f2df1898 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -9,8 +9,8 @@ use crate::{ database::{Coin, DatabaseConnection, DatabaseInterface}, descriptors, spend::{ - check_output_value, create_spend, AddrInfo, CandidateCoin, CreateSpendRes, - SpendCreationError, SpendOutputAddress, TxGetter, + create_spend, AddrInfo, CandidateCoin, CreateSpendRes, SpendCreationError, + SpendOutputAddress, TxGetter, }, DaemonControl, VERSION, }; @@ -443,13 +443,11 @@ impl DaemonControl { let mut db_conn = self.db.connection(); let mut tx_getter = BitcoindTxGetter::new(&self.bitcoin); - // Check the destination addresses are valid for the network and - // sanity check each output's value. + // Prepare the destination addresses. let mut destinations_checked = Vec::with_capacity(destinations.len()); for (address, value_sat) in destinations { let address = self.validate_address(address.clone())?; let amount = bitcoin::Amount::from_sat(*value_sat); - check_output_value(amount)?; let address = self.spend_addr(&mut db_conn, address); destinations_checked.push((address, amount)); } diff --git a/src/spend.rs b/src/spend.rs index a57f6f45..d6384617 100644 --- a/src/spend.rs +++ b/src/spend.rs @@ -81,7 +81,7 @@ impl fmt::Display for SpendCreationError { impl std::error::Error for SpendCreationError {} // Sanity check the value of a transaction output. -pub fn check_output_value(value: bitcoin::Amount) -> Result<(), SpendCreationError> { +fn check_output_value(value: bitcoin::Amount) -> Result<(), SpendCreationError> { // NOTE: the network parameter isn't used upstream if value.to_sat() > bitcoin::blockdata::constants::MAX_MONEY || value.to_sat() < DUST_OUTPUT_SATS