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

Commit a8e26c5

Browse files
authored
Merge pull request #249 from federicobond/fix-getfee
Fix getFee returning value instead of failing when called twice
2 parents 8bb520d + 18eea4b commit a8e26c5

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

lib/transaction/transaction.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -902,13 +902,11 @@ Transaction.prototype._getOutputAmount = function() {
902902
*/
903903
Transaction.prototype._getInputAmount = function() {
904904
if (_.isUndefined(this._inputAmount)) {
905-
var self = this;
906-
this._inputAmount = 0;
907-
_.each(this.inputs, function(input) {
905+
this._inputAmount = _.sumBy(this.inputs, function(input) {
908906
if (_.isUndefined(input.output)) {
909907
throw new errors.Transaction.Input.MissingPreviousOutput();
910908
}
911-
self._inputAmount += input.output.satoshis;
909+
return input.output.satoshis;
912910
});
913911
}
914912
return this._inputAmount;

0 commit comments

Comments
 (0)