Skip to content

Commit

Permalink
gui: set PSBT with no inputs as Deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
jp1ac4 committed Nov 22, 2023
1 parent 4016a72 commit 2c29cd5
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions gui/src/daemon/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,13 @@ impl SpendTx {
);

let mut inputs_amount = Amount::from_sat(0);
let mut status = SpendStatus::Pending;
let mut status = if coins.is_empty() {
// Coins will be empty if transaction was spending outputs from an unconfirmed
// transaction that is no longer in the mempool, e.g. if it was replaced.
SpendStatus::Deprecated
} else {
SpendStatus::Pending
};
for coin in &coins {
inputs_amount += coin.amount;
if let Some(info) = coin.spend_info {
Expand All @@ -88,10 +94,11 @@ impl SpendTx {
} else {
status = SpendStatus::Broadcast
}
// FIXME: This is a quick change so that replacement transactions can be
// signed and broadcast.
// A replacement transaction would use a coin with a different spend tx.
// It should remain as Pending so that it can be broadcast.
// The txid will be different if this PSBT is to replace another transaction
// that is currently spending the coin.
// The PSBT status should remain as Pending so that it can be signed and broadcast.
// Once the replacement transaction has been confirmed, the PSBT for the
// transaction currently spending this coin will be shown as Deprecated.
} else if info.height.is_some() {
status = SpendStatus::Deprecated
}
Expand Down

0 comments on commit 2c29cd5

Please sign in to comment.