|
|
@ -1223,9 +1223,7 @@ WalletService.prototype._checkTxAndEstimateFee = function(txp) { |
|
|
|
serializationOpts.disableLargeFees = true; |
|
|
|
} |
|
|
|
|
|
|
|
if (_.isNumber(txp.feePerKb)) { |
|
|
|
txp.estimateFee(); |
|
|
|
} |
|
|
|
txp.estimateFee(); |
|
|
|
|
|
|
|
try { |
|
|
|
var bitcoreTx = txp.getBitcoreTx(); |
|
|
@ -1544,7 +1542,6 @@ WalletService.prototype.createTxLegacy = function(opts, cb) { |
|
|
|
* @param {string} opts.outputs[].message - A message to attach to this output. |
|
|
|
* @param {string} opts.message - A message to attach to this transaction. |
|
|
|
* @param {Array} opts.inputs - Optional. Inputs for this TX |
|
|
|
* @param {string} opts.fee - Optional. Use an alternative fee for this TX (mutually exclusive with feePerKb) |
|
|
|
* @param {string} opts.feePerKb - Optional. Use an alternative fee per KB for this TX (mutually exclusive with fee) |
|
|
|
* @param {string} opts.feeLevel - Optional. Specify the fee level used to compute feePerKb for this txp. |
|
|
|
* @param {string} opts.payProUrl - Optional. Paypro URL for peers to verify TX |
|
|
@ -1558,18 +1555,9 @@ WalletService.prototype.createTx = function(opts, cb) { |
|
|
|
if (!Utils.checkRequired(opts, ['outputs'])) |
|
|
|
return cb(new ClientError('Required argument missing')); |
|
|
|
|
|
|
|
if (_.isNumber(opts.fee)) { |
|
|
|
if (_.isNumber(opts.feePerKb)) |
|
|
|
return cb(new ClientError('Cannot sepcify both fee and feePerKb arguments')); |
|
|
|
opts.feePerKb = null; |
|
|
|
if (opts.fee < Defaults.MIN_TX_FEE || opts.fee > Defaults.MAX_TX_FEE) |
|
|
|
return cb(new ClientError('Invalid fee')); |
|
|
|
} else { |
|
|
|
opts.fee = null; |
|
|
|
opts.feePerKb = opts.feePerKb || Defaults.DEFAULT_FEE_PER_KB; |
|
|
|
if (opts.feePerKb < Defaults.MIN_FEE_PER_KB || opts.feePerKb > Defaults.MAX_FEE_PER_KB) |
|
|
|
return cb(new ClientError('Invalid fee per KB')); |
|
|
|
} |
|
|
|
opts.feePerKb = opts.feePerKb || Defaults.DEFAULT_FEE_PER_KB; |
|
|
|
if (opts.feePerKb < Defaults.MIN_FEE_PER_KB || opts.feePerKb > Defaults.MAX_FEE_PER_KB) |
|
|
|
return cb(new ClientError('Invalid fee per KB')); |
|
|
|
|
|
|
|
self._runLocked(cb, function(cb) { |
|
|
|
self.getWallet({}, function(err, wallet) { |
|
|
@ -1594,7 +1582,6 @@ WalletService.prototype.createTx = function(opts, cb) { |
|
|
|
outputs: opts.outputs, |
|
|
|
message: opts.message, |
|
|
|
changeAddress: wallet.createAddress(true), |
|
|
|
fee: opts.fee, |
|
|
|
feePerKb: opts.feePerKb, |
|
|
|
feeLevel: opts.feeLevel, |
|
|
|
payProUrl: opts.payProUrl, |
|
|
|