mtx: maxFee option.
This commit is contained in:
parent
8ed5016108
commit
e5d23945b1
@ -230,6 +230,12 @@ HTTPServer.prototype._init = function _init() {
|
||||
assert(utils.isUInt32(options.age), 'Age must be a number.');
|
||||
}
|
||||
|
||||
if (params.fee)
|
||||
options.fee = utils.satoshi(params.fee);
|
||||
|
||||
if (params.maxFee)
|
||||
options.maxFee = utils.satoshi(params.maxFee);
|
||||
|
||||
if (params.rate)
|
||||
options.rate = utils.satoshi(params.rate);
|
||||
|
||||
|
||||
@ -1250,7 +1250,7 @@ MTX.prototype.selectCoins = function selectCoins(coins, options) {
|
||||
// bytes (10000 satoshi for every 1024 bytes).
|
||||
do {
|
||||
// Calculate max possible size after signing.
|
||||
size = tx.maxSize(options.key, options.script);
|
||||
size = tx.maxSize(options);
|
||||
|
||||
if (tryFree && options.height >= 0) {
|
||||
// Note that this will only work
|
||||
@ -1272,6 +1272,13 @@ MTX.prototype.selectCoins = function selectCoins(coins, options) {
|
||||
if (fee > constants.tx.MAX_FEE)
|
||||
fee = constants.tx.MAX_FEE;
|
||||
|
||||
if (options.maxFee && fee > options.maxFee) {
|
||||
throw new FundingError(
|
||||
'Fee is too high.',
|
||||
tx.getInputValue(),
|
||||
total());
|
||||
}
|
||||
|
||||
// Failed to get enough funds, add more coins.
|
||||
if (!isFull())
|
||||
addCoins();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user