Skip to content

Commit

Permalink
Cleanup outputs when deleting addresses.
Browse files Browse the repository at this point in the history
  • Loading branch information
caedesvvv committed Jan 22, 2015
1 parent de94bba commit 147ae7b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/js/model/wallet.js
Expand Up @@ -340,6 +340,15 @@ Wallet.prototype.deleteAddress = function(seq) {
this.wallet.addresses.splice(this.wallet.addresses.indexOf(walletAddress.address), 1);
delete this.pubKeys[seq];
delete this.addresses[walletAddress.address];

// Delete related outputs
var self = this;
Object.keys(this.wallet.outputs).forEach(function(outputId) {
var output = self.wallet.outputs[outputId];
if (output.address === walletAddress.address) {
self.deleteOutput(output);
}
});
};

/**
Expand Down

0 comments on commit 147ae7b

Please sign in to comment.