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.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;

2
lib/server.js

@ -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;

8
test/integration/server.js

@ -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…
Cancel
Save