Merge #1209: gui: disable replacement fee input if tx is already replaced

ad2c096715da49223f7c2cf3389e575b7e62a064 gui: disable replacement fee input if tx is already replaced (pythcoiner)

Pull request description:

  this PR disable input on feerate TextInput if the tx already have been replaced, it's fine to do so because we still can RBF the new replacing tx.

  ![image](https://github.com/user-attachments/assets/c5ad2ed3-50f0-41e0-924b-261896174900)

  close #1138

ACKs for top commit:
  jp1ac4:
    tACK ad2c096715.

Tree-SHA512: 528dc513ee83a839c86a6dd8d49fa5af61814e7c440d5337d294205269ebcef3d50001a5b41815c95276d4f3e6660d5f5e081456feb77843b527d8f9eed897b8
This commit is contained in:
edouardparis 2025-05-01 14:09:35 +02:00
commit 102a8d841d
No known key found for this signature in database
GPG Key ID: E65F7A089C20DC8F
2 changed files with 24 additions and 7 deletions

View File

@ -257,13 +257,17 @@ pub fn create_rbf_modal<'a>(
.push(Container::new(p1_bold("Feerate")).padding(10))
.spacing(10)
.push(
form::Form::new_trimmed("", feerate, move |msg| {
Message::CreateRbf(CreateRbfMessage::FeerateEdited(msg))
})
.warning(
"Feerate must be greater than previous value and \
less than or equal to 1000 sats/vbyte",
)
if replacement_txid.is_none() {
form::Form::new_trimmed("", feerate, move |msg| {
Message::CreateRbf(CreateRbfMessage::FeerateEdited(msg))
})
.warning(
"Feerate must be greater than previous value and \
less than or equal to 1000 sats/vbyte",
)
} else {
form::Form::new_disabled("", feerate)
}
.size(P1_SIZE)
.padding(10),
)

View File

@ -46,6 +46,19 @@ where
}
}
/// Creates a new [`Form`] that has a disabled input.
///
/// It expects:
/// - a placeholder
/// - the current value
pub fn new_disabled(placeholder: &str, value: &Value<String>) -> Self {
Self {
input: text_input::TextInput::new(placeholder, &value.value),
warning: None,
valid: value.valid,
}
}
/// Creates a new [`Form`] that trims input values before applying the `on_change` function.
///
/// It expects: