From 8865d42ec3fd654121878f8b4057a8b9c80e47f3 Mon Sep 17 00:00:00 2001 From: Ivan Socolsky Date: Thu, 10 Mar 2016 12:32:16 -0300 Subject: [PATCH] improve fee computation for P2PKH wallets --- lib/model/txproposal.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/model/txproposal.js b/lib/model/txproposal.js index f6dd382..2697c4c 100644 --- a/lib/model/txproposal.js +++ b/lib/model/txproposal.js @@ -228,7 +228,13 @@ TxProposal.prototype.getRawTx = function() { }; TxProposal.prototype.getEstimatedSizeForSingleInput = function() { - return this.requiredSignatures * 72 + this.walletN * 36 + 44; + switch (this.addressType) { + case Constants.SCRIPT_TYPES.P2PKH: + return 147; + default: + case Constants.SCRIPT_TYPES.P2SH: + return this.requiredSignatures * 72 + this.walletN * 36 + 44; + } }; TxProposal.prototype.getEstimatedSize = function() {