Skip to content

Commit

Permalink
fix: swap allowAbsurdFees for maxFeeRate for Dash Core v18 (#90)
Browse files Browse the repository at this point in the history
* fix: swap allowAbsurdFees for maxFeeRate for Dash Core v18

* f: 1000 => 0.00001000
  • Loading branch information
AJ ONeal authored Sep 19, 2022
1 parent 97e7d32 commit 95e1606
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
16 changes: 11 additions & 5 deletions lib/services/dashd.js
Original file line number Diff line number Diff line change
Expand Up @@ -2075,25 +2075,31 @@ Dash.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 {Object=} options
* @param {Boolean=} options.allowAbsurdFees - Enable large fees
* @param {Boolean=} options.maxFeeRate - Cap large fees (0 for unlimited)
* @param {Function} callback
*/
Dash.prototype.sendTransaction = function(tx, options, callback) {
var self = this;
var allowAbsurdFees = false;
var maxFeeRate = 0.00001000; // duff/kB (typically less than 1000)
var isInstantSend = false;
if (_.isFunction(options) && _.isUndefined(callback)) {
callback = options;
} else if (_.isObject(options)) {
if(options.hasOwnProperty('maxFeeRate')){
maxFeeRate = options.maxFeeRate;
}
if(options.hasOwnProperty('allowAbsurdFees')){
allowAbsurdFees = options.allowAbsurdFees;
console.warn(`the boolean 'allowAbsurdFees' has been replaced by the int 'maxFeeRate'`);
if(false === options.allowAbsurdFees) {
maxFeeRate = 0; // unlimited
}
}
if(options.hasOwnProperty('isInstantSend')){
isInstantSend = options.isInstantSend;
isInstantSend = options.isInstantSend;
}
}

this.client.sendRawTransaction(tx, allowAbsurdFees, isInstantSend, function(err, response) {
this.client.sendRawTransaction(tx, maxFeeRate, isInstantSend, function(err, response) {
if (err) {
return callback(self._wrapRPCError(err));
}
Expand Down
2 changes: 1 addition & 1 deletion test/services/dashd.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -4580,7 +4580,7 @@ describe('Dash Service', function() {
sendRawTransaction: sendRawTransaction
}
});
dashd.sendTransaction(txhex, {allowAbsurdFees: true}, function(err, hash) {
dashd.sendTransaction(txhex, {maxFeeRate: 0}, function(err, hash) {
if (err) {
return done(err);
}
Expand Down

0 comments on commit 95e1606

Please sign in to comment.