Skip to content

Commit

Permalink
Make sure estimateFees in KB isn't below 1
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlyp committed Feb 24, 2016
1 parent 2aaab2c commit f80e2fe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 3 additions & 1 deletion lib/model/txproposal.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,9 @@ TxProposal.prototype.getEstimatedSize = function() {
};

TxProposal.prototype.estimateFee = function() {
var fee = 5000000 * this.getEstimatedSize() / 1000;
var txSize = this.getEstimatedSize() / 1000;
txSize = txSize < 1 ? 1 : txSize;
var fee = 1000000 * txSize;

this.fee = parseInt(fee.toFixed(0));
};
Expand Down
3 changes: 0 additions & 3 deletions lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -1063,7 +1063,6 @@ WalletService.prototype._selectTxInputs = function(txp, utxosToExclude, cb) {
return cb();
}
} catch (ex) {
console.log(serializationOpts);
log.error('Error building Bitcore transaction', ex);
return cb(ex);
}
Expand Down Expand Up @@ -1131,7 +1130,6 @@ WalletService.prototype.createTx = function(opts, cb) {
opts.outputs = _.pick(opts, ['amount', 'toAddress']);
}
opts.outputs = [].concat(opts.outputs);
console.log(opts.outputs);
if (!Utils.checkRequired(opts, ['outputs', 'proposalSignature']))
return cb(new ClientError('Required argument missing'));

Expand Down Expand Up @@ -1236,7 +1234,6 @@ WalletService.prototype.createTx = function(opts, cb) {
}

var txp = Model.TxProposal.create(txOpts);
console.log(txp);

if (!self._clientSupportsTXPv2()) {
txp.version = '1.0.1';
Expand Down

0 comments on commit f80e2fe

Please sign in to comment.