Skip to content

Commit

Permalink
Fix clearing a spend.
Browse files Browse the repository at this point in the history
  • Loading branch information
caedesvvv committed Dec 17, 2014
1 parent 6f37472 commit 1a32a94
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
12 changes: 12 additions & 0 deletions src/js/model/output.js
Expand Up @@ -31,6 +31,18 @@ Output.prototype.markSpend = function(outId, height) {
this.spendheight = height || 0;
}

/**
* Clear this output's spend
*/
Output.prototype.clearSpend = function() {
if (this.spendheight) {
throw Error("Output is already confirmed!");
}
this.spend = false;
this.spendpending = false;
};


/**
* Receive id for the output ("hash:index")
*/
Expand Down
4 changes: 1 addition & 3 deletions src/js/model/tx.js
Expand Up @@ -272,9 +272,7 @@ Transaction.prototype.undo = function(tx, row) {
var walletAddress = wallet.getWalletAddress(output.address);
walletAddress.balance += output.value;
}
delete output.spend;
delete output.spendheight;
delete output.spendpending;
output.clearSpend();
}
});
tx.outs.forEach(function(anOut, i) {
Expand Down

0 comments on commit 1a32a94

Please sign in to comment.