Merge pull request #631 from isocolsky/feat/urgent-fee
Add 'Urgent' fee level
This commit is contained in:
commit
8a63447dc0
|
@ -25,21 +25,26 @@ Defaults.MAX_MAIN_ADDRESS_GAP = 20;
|
|||
Defaults.SCAN_ADDRESS_GAP = Defaults.MAX_MAIN_ADDRESS_GAP + 20;
|
||||
|
||||
Defaults.FEE_LEVELS = [{
|
||||
name: 'urgent',
|
||||
nbBlocks: 2,
|
||||
multiplier: 1.5,
|
||||
defaultValue: 150000,
|
||||
}, {
|
||||
name: 'priority',
|
||||
nbBlocks: 2,
|
||||
defaultValue: 50000
|
||||
defaultValue: 100000
|
||||
}, {
|
||||
name: 'normal',
|
||||
nbBlocks: 3,
|
||||
defaultValue: 40000
|
||||
defaultValue: 80000
|
||||
}, {
|
||||
name: 'economy',
|
||||
nbBlocks: 6,
|
||||
defaultValue: 25000
|
||||
defaultValue: 50000
|
||||
}, {
|
||||
name: 'superEconomy',
|
||||
nbBlocks: 24,
|
||||
defaultValue: 10000
|
||||
defaultValue: 20000
|
||||
}];
|
||||
|
||||
Defaults.DEFAULT_FEE_PER_KB = Defaults.FEE_LEVELS[1].defaultValue;
|
||||
|
|
|
@ -1433,7 +1433,7 @@ WalletService.prototype.getFeeLevels = function(opts, cb) {
|
|||
result.nbBlocks = null;
|
||||
} else {
|
||||
var feeLevel = getFeeLevel(feeSamples, level, level.nbBlocks, Defaults.FEE_LEVELS_FALLBACK);
|
||||
result.feePerKb = feeLevel.feePerKb;
|
||||
result.feePerKb = +(feeLevel.feePerKb * (level.multiplier || 1)).toFixed(0);
|
||||
result.nbBlocks = feeLevel.nbBlocks;
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -2146,6 +2146,11 @@ describe('Wallet service', function() {
|
|||
before(function() {
|
||||
levels = Defaults.FEE_LEVELS;
|
||||
Defaults.FEE_LEVELS = [{
|
||||
name: 'urgent',
|
||||
nbBlocks: 1,
|
||||
multiplier: 1.5,
|
||||
defaultValue: 50000,
|
||||
}, {
|
||||
name: 'priority',
|
||||
nbBlocks: 1,
|
||||
defaultValue: 50000
|
||||
|
@ -2186,6 +2191,9 @@ describe('Wallet service', function() {
|
|||
fees = _.zipObject(_.map(fees, function(item) {
|
||||
return [item.level, item];
|
||||
}));
|
||||
fees.urgent.feePerKb.should.equal(60000);
|
||||
fees.urgent.nbBlocks.should.equal(1);
|
||||
|
||||
fees.priority.feePerKb.should.equal(40000);
|
||||
fees.priority.nbBlocks.should.equal(1);
|
||||
|
||||
|
|
Loading…
Reference in New Issue