Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

Commit

Permalink
Merge pull request #249 from federicobond/fix-getfee
Browse files Browse the repository at this point in the history
Fix getFee returning value instead of failing when called twice
  • Loading branch information
matiu authored Nov 30, 2018
2 parents 8bb520d + 18eea4b commit a8e26c5
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/transaction/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -902,13 +902,11 @@ Transaction.prototype._getOutputAmount = function() {
*/
Transaction.prototype._getInputAmount = function() {
if (_.isUndefined(this._inputAmount)) {
var self = this;
this._inputAmount = 0;
_.each(this.inputs, function(input) {
this._inputAmount = _.sumBy(this.inputs, function(input) {
if (_.isUndefined(input.output)) {
throw new errors.Transaction.Input.MissingPreviousOutput();
}
self._inputAmount += input.output.satoshis;
return input.output.satoshis;
});
}
return this._inputAmount;
Expand Down

0 comments on commit a8e26c5

Please sign in to comment.