Skip to content

Commit

Permalink
txdb: fix lockedUnconfirmed if FINALIZE is inserted with block
Browse files Browse the repository at this point in the history
  • Loading branch information
pinheadmz committed Sep 11, 2020
1 parent 7826128 commit 0e7865c
Show file tree
Hide file tree
Showing 2 changed files with 255 additions and 85 deletions.
8 changes: 6 additions & 2 deletions lib/wallet/txdb.js
Expand Up @@ -960,10 +960,14 @@ class TXDB {

// FINALIZE is a special case: locked coins _leave_ the wallet.
if (tx.output(i) && tx.covenant(i).isFinalize()) {
if (!block)
if (!block) {
state.ulocked(path, -tx.outputs[i].value);
else
} else {
state.clocked(path, -tx.outputs[i].value);
// This is the first time we've seen this tx and it is in a block
// (probably from a rescan). Update unconfirmed locked balance also.
state.ulocked(path, -tx.outputs[i].value);
}
}

if (!block) {
Expand Down

0 comments on commit 0e7865c

Please sign in to comment.