bitcoind: sendTransaction second arg as object

This commit is contained in:
Braydon Fuller 2016-04-08 15:52:57 -04:00
parent b4b560aa45
commit 3713c6ac1e
1 changed files with 8 additions and 5 deletions

View File

@ -1139,20 +1139,23 @@ Bitcoin.prototype.estimateFee = function(blocks, callback) {
/**
* Will add a transaction to the mempool and relay to connected peers
* @param {String|Transaction} transaction - The hex string of the transaction
* @param {Boolean=} allowAbsurdFees - Enable large fees
* @param {Object=} options
* @param {Boolean=} options.allowAbsurdFees - Enable large fees
* @param {Function} callback
*/
Bitcoin.prototype.sendTransaction = function(tx, allowAbsurdFees, callback) {
Bitcoin.prototype.sendTransaction = function(tx, options, callback) {
var self = this;
var allowAbsurdFees = false;
var txString;
if (tx instanceof Transaction) {
txString = tx.serialize();
} else {
txString = tx;
}
if (_.isFunction(allowAbsurdFees) && _.isUndefined(callback)) {
callback = allowAbsurdFees;
allowAbsurdFees = false;
if (_.isFunction(options) && _.isUndefined(callback)) {
callback = options;
} else if (_.isObject(options)) {
allowAbsurdFees = options.allowAbsurdFees;
}
this.client.sendRawTransaction(txString, allowAbsurdFees, function(err, response) {