Browse Source

Merge pull request #631 from isocolsky/feat/urgent-fee

Add 'Urgent' fee level
feat/estimateFee-limit
Matias Alejo Garcia 8 years ago
committed by GitHub
parent
commit
8a63447dc0
  1. 13
      lib/common/defaults.js
  2. 2
      lib/server.js
  3. 8
      test/integration/server.js

13
lib/common/defaults.js

@ -25,21 +25,26 @@ Defaults.MAX_MAIN_ADDRESS_GAP = 20;
Defaults.SCAN_ADDRESS_GAP = Defaults.MAX_MAIN_ADDRESS_GAP + 20; Defaults.SCAN_ADDRESS_GAP = Defaults.MAX_MAIN_ADDRESS_GAP + 20;
Defaults.FEE_LEVELS = [{ Defaults.FEE_LEVELS = [{
name: 'urgent',
nbBlocks: 2,
multiplier: 1.5,
defaultValue: 150000,
}, {
name: 'priority', name: 'priority',
nbBlocks: 2, nbBlocks: 2,
defaultValue: 50000 defaultValue: 100000
}, { }, {
name: 'normal', name: 'normal',
nbBlocks: 3, nbBlocks: 3,
defaultValue: 40000 defaultValue: 80000
}, { }, {
name: 'economy', name: 'economy',
nbBlocks: 6, nbBlocks: 6,
defaultValue: 25000 defaultValue: 50000
}, { }, {
name: 'superEconomy', name: 'superEconomy',
nbBlocks: 24, nbBlocks: 24,
defaultValue: 10000 defaultValue: 20000
}]; }];
Defaults.DEFAULT_FEE_PER_KB = Defaults.FEE_LEVELS[1].defaultValue; Defaults.DEFAULT_FEE_PER_KB = Defaults.FEE_LEVELS[1].defaultValue;

2
lib/server.js

@ -1433,7 +1433,7 @@ WalletService.prototype.getFeeLevels = function(opts, cb) {
result.nbBlocks = null; result.nbBlocks = null;
} else { } else {
var feeLevel = getFeeLevel(feeSamples, level, level.nbBlocks, Defaults.FEE_LEVELS_FALLBACK); 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; result.nbBlocks = feeLevel.nbBlocks;
} }
return result; return result;

8
test/integration/server.js

@ -2146,6 +2146,11 @@ describe('Wallet service', function() {
before(function() { before(function() {
levels = Defaults.FEE_LEVELS; levels = Defaults.FEE_LEVELS;
Defaults.FEE_LEVELS = [{ Defaults.FEE_LEVELS = [{
name: 'urgent',
nbBlocks: 1,
multiplier: 1.5,
defaultValue: 50000,
}, {
name: 'priority', name: 'priority',
nbBlocks: 1, nbBlocks: 1,
defaultValue: 50000 defaultValue: 50000
@ -2186,6 +2191,9 @@ describe('Wallet service', function() {
fees = _.zipObject(_.map(fees, function(item) { fees = _.zipObject(_.map(fees, function(item) {
return [item.level, 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.feePerKb.should.equal(40000);
fees.priority.nbBlocks.should.equal(1); fees.priority.nbBlocks.should.equal(1);

Loading…
Cancel
Save