Browse Source

Merge pull request #1158 from carnesen/getFee

Update transaction.getFee() JSDoc
patch-2
Esteban Ordano 10 years ago
parent
commit
45f3ab9b56
  1. 19
      lib/transaction/transaction.js

19
lib/transaction/transaction.js

@ -741,13 +741,20 @@ Transaction.prototype._updateChangeOutput = function() {
}
};
/**
* Calculates the fees for the transaction.
* Calculates the fee of the transaction.
*
* If there is no change output set, the fee will be the
* output amount minus the input amount.
* If there's a fixed fee set, return that
* If there's no fee set, estimate it based on size
* @return {Number} miner fee for this transaction in satoshis
* If there is no change output set, the fee is the
* total value of the outputs minus inputs. Note that
* a serialized transaction only specifies the value
* of its outputs. (The value of inputs are recorded
* in the previous transaction outputs being spent.)
* This method therefore raises a "MissingPreviousOutput"
* error when called on a serialized transaction.
*
* If there's a fixed fee set, return that.
* If there's no fee set, estimate it based on size.
*
* @return {Number} fee of this transaction in satoshis
*/
Transaction.prototype.getFee = function() {
// if no change output is set, fees should equal all the unspent amount

Loading…
Cancel
Save