Skip to content

Commit

Permalink
txdb: use covenant helper method isFinalize()
Browse files Browse the repository at this point in the history
  • Loading branch information
pinheadmz committed Jun 4, 2020
1 parent 144881c commit d6282b8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/wallet/txdb.js
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,7 @@ class TXDB {
state.unconfirmed(path, -coin.value);

// FINALIZE is a special case: locked coins _leave_ the wallet.
if (tx.output(i) && tx.covenant(i).type === types.FINALIZE) {
if (tx.output(i) && tx.covenant(i).isFinalize()) {
if (!block)
state.ulocked(path, -tx.outputs[i].value);
else
Expand Down Expand Up @@ -1166,7 +1166,7 @@ class TXDB {
state.confirmed(path, -coin.value);

// FINALIZE is a special case: locked coins _leave_ the wallet.
if (tx.output(i) && tx.covenant(i).type === types.FINALIZE)
if (tx.output(i) && tx.covenant(i).isFinalize())
state.clocked(path, -tx.outputs[i].value);

await this.removeCredit(b, credit, path);
Expand Down Expand Up @@ -1314,7 +1314,7 @@ class TXDB {

// FINALIZE is a special case: locked coins _leave_ the wallet.
// In this case a TX is erased, adding them back.
if (tx.output(i) && tx.covenant(i).type === types.FINALIZE) {
if (tx.output(i) && tx.covenant(i).isFinalize()) {
if (!block)
state.ulocked(path, tx.outputs[i].value);
else
Expand Down Expand Up @@ -1522,7 +1522,7 @@ class TXDB {

// FINALIZE is a special case: locked coins _leave_ the wallet.
// In this case a TX is reversed, adding them back.
if (tx.output(i) && tx.covenant(i).type === types.FINALIZE)
if (tx.output(i) && tx.covenant(i).isFinalize())
state.clocked(path, tx.outputs[i].value);

// Resave the credit and mark it
Expand Down

0 comments on commit d6282b8

Please sign in to comment.