|
|
@ -1219,8 +1219,11 @@ WalletService.prototype._checkTxAndEstimateFee = function(txp) { |
|
|
|
serializationOpts.disableLargeFees = true; |
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
if (_.isNumber(txp.feePerKb)) { |
|
|
|
txp.estimateFee(); |
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
var bitcoreTx = txp.getBitcoreTx(); |
|
|
|
bitcoreError = bitcoreTx.getSerializationError(serializationOpts); |
|
|
|
if (!bitcoreError) { |
|
|
@ -1535,7 +1538,8 @@ 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.feePerKb - Optional. Use an alternative fee per KB 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.payProUrl - Optional. Paypro URL for peers to verify TX |
|
|
|
* @param {string} opts.excludeUnconfirmedUtxos[=false] - Optional. Do not use UTXOs of unconfirmed transactions as inputs |
|
|
|
* @param {string} opts.validateOutputs[=true] - Optional. Perform validation on outputs. |
|
|
@ -1547,9 +1551,15 @@ WalletService.prototype.createTx = function(opts, cb) { |
|
|
|
if (!Utils.checkRequired(opts, ['outputs'])) |
|
|
|
return cb(new ClientError('Required argument missing')); |
|
|
|
|
|
|
|
var feePerKb = opts.feePerKb || Defaults.DEFAULT_FEE_PER_KB; |
|
|
|
if (feePerKb < Defaults.MIN_FEE_PER_KB || feePerKb > Defaults.MAX_FEE_PER_KB) |
|
|
|
return cb(new ClientError('Invalid fee per KB value')); |
|
|
|
if (_.isNumber(opts.fee)) { |
|
|
|
if (opts.fee < Defaults.MIN_FEE || opts.fee > Defaults.MAX_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')); |
|
|
|
} |
|
|
|
|
|
|
|
self._runLocked(cb, function(cb) { |
|
|
|
self.getWallet({}, function(err, wallet) { |
|
|
@ -1574,7 +1584,8 @@ WalletService.prototype.createTx = function(opts, cb) { |
|
|
|
outputs: opts.outputs, |
|
|
|
message: opts.message, |
|
|
|
changeAddress: wallet.createAddress(true), |
|
|
|
feePerKb: feePerKb, |
|
|
|
fee: opts.fee, |
|
|
|
feePerKb: opts.feePerKb, |
|
|
|
payProUrl: opts.payProUrl, |
|
|
|
walletM: wallet.m, |
|
|
|
walletN: wallet.n, |
|
|
|