commands: remove redundant output value check
It's already performed (twice) in spend::create_psbt()
This commit is contained in:
parent
5894e788b8
commit
f3113ba0d2
@ -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));
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user