Merge #743: gui: coinbase transaction output scripts may not represent valid addresses
2f2975c2790e83c592cd0ff594d3e8ce8a7c75d9 coinbase transaction outputs may not have valid scripts (edouard) Pull request description: close #738 liana-gui v2 also tried to display addresses from transaction outputs to user when clicking on transaction detail. ACKs for top commit: edouardparis: Self-ACK 2f2975c2790e83c592cd0ff594d3e8ce8a7c75d9 Tree-SHA512: 7f5fc374baec773fef848cd104b8acbd34ce19a04f9614d0c446a93ee8b6b976acd98d7494031651a614bef38c0913217865f2086bf19a018ce17f57ef362c57
This commit is contained in:
commit
ec2e2e5edc
@ -158,17 +158,14 @@ fn event_list_view(i: usize, event: &HistoryTransaction) -> Column<'_, Message>
|
|||||||
.to_string(),
|
.to_string(),
|
||||||
) {
|
) {
|
||||||
Some(p1_regular(label))
|
Some(p1_regular(label))
|
||||||
|
} else if let Ok(addr) =
|
||||||
|
bitcoin::Address::from_script(&output.script_pubkey, event.network)
|
||||||
|
{
|
||||||
|
event.labels.get(&addr.to_string()).map(|label| {
|
||||||
|
p1_regular(format!("address label: {}", label)).style(color::GREY_3)
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
event
|
None
|
||||||
.labels
|
|
||||||
.get(
|
|
||||||
&bitcoin::Address::from_script(&output.script_pubkey, event.network)
|
|
||||||
.unwrap()
|
|
||||||
.to_string(),
|
|
||||||
)
|
|
||||||
.map(|label| {
|
|
||||||
p1_regular(format!("address label: {}", label)).style(color::GREY_3)
|
|
||||||
})
|
|
||||||
};
|
};
|
||||||
if event.is_external() {
|
if event.is_external() {
|
||||||
if !event.change_indexes.contains(&output_index) {
|
if !event.change_indexes.contains(&output_index) {
|
||||||
|
|||||||
@ -820,8 +820,8 @@ fn payment_view<'a>(
|
|||||||
labels_editing: &'a HashMap<String, form::Value<String>>,
|
labels_editing: &'a HashMap<String, form::Value<String>>,
|
||||||
) -> Element<'a, Message> {
|
) -> Element<'a, Message> {
|
||||||
let addr = Address::from_script(&output.script_pubkey, network)
|
let addr = Address::from_script(&output.script_pubkey, network)
|
||||||
.unwrap()
|
.ok()
|
||||||
.to_string();
|
.map(|a| a.to_string());
|
||||||
let outpoint = OutPoint {
|
let outpoint = OutPoint {
|
||||||
txid,
|
txid,
|
||||||
vout: i as u32,
|
vout: i as u32,
|
||||||
@ -848,7 +848,7 @@ fn payment_view<'a>(
|
|||||||
)
|
)
|
||||||
.push(amount(&Amount::from_sat(output.value))),
|
.push(amount(&Amount::from_sat(output.value))),
|
||||||
)
|
)
|
||||||
.push(
|
.push_maybe(addr.map(|addr| {
|
||||||
Column::new()
|
Column::new()
|
||||||
.push(
|
.push(
|
||||||
Row::new()
|
Row::new()
|
||||||
@ -880,8 +880,8 @@ fn payment_view<'a>(
|
|||||||
.push(p1_bold("Address label:").style(color::GREY_3))
|
.push(p1_bold("Address label:").style(color::GREY_3))
|
||||||
.push(p2_regular(label).style(color::GREY_3)),
|
.push(p2_regular(label).style(color::GREY_3)),
|
||||||
)
|
)
|
||||||
})),
|
}))
|
||||||
)
|
}))
|
||||||
.into()
|
.into()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -365,9 +365,9 @@ impl Labelled for HistoryTransaction {
|
|||||||
txid,
|
txid,
|
||||||
vout: vout as u32,
|
vout: vout as u32,
|
||||||
}));
|
}));
|
||||||
items.push(LabelItem::Address(
|
if let Ok(addr) = Address::from_script(&output.script_pubkey, self.network) {
|
||||||
Address::from_script(&output.script_pubkey, self.network).unwrap(),
|
items.push(LabelItem::Address(addr));
|
||||||
));
|
}
|
||||||
}
|
}
|
||||||
items
|
items
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user