fix single payment output label
When a transaction has only one payment, then its txid label is attached to the payment label. While modifying the label of an output it did not change the whole transaction label, which is a bug.
This commit is contained in:
parent
7e039d7e38
commit
d56a9a8a40
@ -325,6 +325,7 @@ pub fn payment_view<'a>(
|
||||
},
|
||||
&tx.labels,
|
||||
labels_editing,
|
||||
tx.is_single_payment().is_some(),
|
||||
))
|
||||
.spacing(20),
|
||||
)
|
||||
|
||||
@ -82,6 +82,7 @@ pub fn psbt_view<'a>(
|
||||
Some(tx.change_indexes.clone()),
|
||||
&tx.labels,
|
||||
labels_editing,
|
||||
tx.is_single_payment().is_some(),
|
||||
))
|
||||
.push(if saved {
|
||||
Row::new()
|
||||
@ -542,6 +543,7 @@ pub fn inputs_and_outputs_view<'a>(
|
||||
change_indexes: Option<Vec<usize>>,
|
||||
labels: &'a HashMap<String, String>,
|
||||
labels_editing: &'a HashMap<String, form::Value<String>>,
|
||||
is_single_payment: bool,
|
||||
) -> Element<'a, Message> {
|
||||
let change_indexes_copy = change_indexes.clone();
|
||||
Column::new()
|
||||
@ -674,6 +676,7 @@ pub fn inputs_and_outputs_view<'a>(
|
||||
network,
|
||||
labels,
|
||||
labels_editing,
|
||||
is_single_payment,
|
||||
))
|
||||
},
|
||||
)
|
||||
@ -825,6 +828,7 @@ fn payment_view<'a>(
|
||||
network: Network,
|
||||
labels: &'a HashMap<String, String>,
|
||||
labels_editing: &'a HashMap<String, form::Value<String>>,
|
||||
is_single: bool,
|
||||
) -> Element<'a, Message> {
|
||||
let addr = Address::from_script(&output.script_pubkey, network)
|
||||
.ok()
|
||||
@ -834,6 +838,13 @@ fn payment_view<'a>(
|
||||
vout: i as u32,
|
||||
}
|
||||
.to_string();
|
||||
// if the payment is single in the transaction, then the label of the txid
|
||||
// is attached to the label of the payment.
|
||||
let change_labels = if is_single {
|
||||
vec![outpoint.clone(), txid.to_string()]
|
||||
} else {
|
||||
vec![outpoint.clone()]
|
||||
};
|
||||
Column::new()
|
||||
.width(Length::Fill)
|
||||
.spacing(5)
|
||||
@ -843,13 +854,9 @@ fn payment_view<'a>(
|
||||
.align_items(Alignment::Center)
|
||||
.push(
|
||||
Container::new(if let Some(label) = labels_editing.get(&outpoint) {
|
||||
label::label_editing(vec![outpoint.clone()], label, text::P1_SIZE)
|
||||
label::label_editing(change_labels, label, text::P1_SIZE)
|
||||
} else {
|
||||
label::label_editable(
|
||||
vec![outpoint.clone()],
|
||||
labels.get(&outpoint),
|
||||
text::P1_SIZE,
|
||||
)
|
||||
label::label_editable(change_labels, labels.get(&outpoint), text::P1_SIZE)
|
||||
})
|
||||
.width(Length::Fill),
|
||||
)
|
||||
|
||||
@ -56,6 +56,7 @@ pub fn spend_view<'a>(
|
||||
Some(tx.change_indexes.clone()),
|
||||
&tx.labels,
|
||||
labels_editing,
|
||||
tx.is_single_payment().is_some(),
|
||||
))
|
||||
.push(if saved {
|
||||
Row::new()
|
||||
|
||||
@ -260,6 +260,7 @@ pub fn tx_view<'a>(
|
||||
},
|
||||
&tx.labels,
|
||||
labels_editing,
|
||||
tx.is_single_payment().is_some(),
|
||||
))
|
||||
.spacing(20),
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user