Add spent tag to confirmed broadcast tx

close #233
This commit is contained in:
edouard 2023-02-16 10:49:22 +01:00
parent 120f87462f
commit 9535b80258
3 changed files with 8 additions and 1 deletions

View File

@ -212,6 +212,7 @@ fn spend_header<'a>(tx: &SpendTx) -> Element<'a, Message> {
.push_maybe(match tx.status {
SpendStatus::Deprecated => Some(badge::deprecated()),
SpendStatus::Broadcast => Some(badge::unconfirmed()),
SpendStatus::Spent => Some(badge::spent()),
_ => None,
})
.push(

View File

@ -158,6 +158,7 @@ fn spend_tx_list_view<'a>(i: usize, tx: &SpendTx) -> Element<'a, Message> {
.push_maybe(match tx.status {
SpendStatus::Deprecated => Some(badge::deprecated()),
SpendStatus::Broadcast => Some(badge::unconfirmed()),
SpendStatus::Spent => Some(badge::spent()),
_ => None,
})
.push(

View File

@ -37,6 +37,7 @@ pub enum SpendStatus {
Pending,
Deprecated,
Broadcast,
Spent,
}
impl SpendTx {
@ -60,7 +61,11 @@ impl SpendTx {
inputs_amount += coin.amount;
if let Some(info) = coin.spend_info {
if info.txid == psbt.unsigned_tx.txid() {
status = SpendStatus::Broadcast
if info.height.is_some() {
status = SpendStatus::Spent
} else {
status = SpendStatus::Broadcast
}
} else {
status = SpendStatus::Deprecated
}