parent
ecd35d2bd1
commit
86896c8223
@ -21,6 +21,9 @@ use crate::{
|
||||
ui::component::form,
|
||||
};
|
||||
|
||||
/// See: https://github.com/wizardsardine/liana/blob/master/src/commands/mod.rs#L32
|
||||
const DUST_OUTPUT_SATS: u64 = 5_000;
|
||||
|
||||
#[derive(Default, Clone)]
|
||||
pub struct TransactionDraft {
|
||||
inputs: Vec<Coin>,
|
||||
@ -162,6 +165,10 @@ impl Recipient {
|
||||
return Err(Error::Unexpected("Amount should be non-zero".to_string()));
|
||||
}
|
||||
|
||||
if amount.to_sat() < DUST_OUTPUT_SATS {
|
||||
return Err(Error::Unexpected("Amount should be non-zero".to_string()));
|
||||
}
|
||||
|
||||
if let Ok(address) = Address::from_str(&self.address.value) {
|
||||
if amount <= address.script_pubkey().dust_value() {
|
||||
return Err(Error::Unexpected(
|
||||
|
||||
@ -100,11 +100,11 @@ pub fn recipient_view<'a>(
|
||||
form::Form::new("Amount", amount, move |msg| {
|
||||
CreateSpendMessage::RecipientEdited(index, "amount", msg)
|
||||
})
|
||||
.warning("Please enter correct amount")
|
||||
.warning("Please enter correct amount (> 5000 sats)")
|
||||
.size(20)
|
||||
.padding(10),
|
||||
)
|
||||
.width(Length::Units(250)),
|
||||
.width(Length::Units(300)),
|
||||
)
|
||||
.spacing(5)
|
||||
.push(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user