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

Commit 18eea4b

Browse files
committed
Fix getFee returning value instead of failing when called twice
1 parent 8658360 commit 18eea4b

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
@@ -899,13 +899,11 @@ Transaction.prototype._getOutputAmount = function() {
899899
*/
900900
Transaction.prototype._getInputAmount = function() {
901901
if (_.isUndefined(this._inputAmount)) {
902-
var self = this;
903-
this._inputAmount = 0;
904-
_.each(this.inputs, function(input) {
902+
this._inputAmount = _.sumBy(this.inputs, function(input) {
905903
if (_.isUndefined(input.output)) {
906904
throw new errors.Transaction.Input.MissingPreviousOutput();
907905
}
908-
self._inputAmount += input.output.satoshis;
906+
return input.output.satoshis;
909907
});
910908
}
911909
return this._inputAmount;

0 commit comments

Comments
 (0)