remove emergency level
This commit is contained in:
parent
833a322801
commit
c85111c5b2
|
@ -793,25 +793,17 @@ WalletService.prototype.getFeeLevels = function(opts, cb) {
|
||||||
return cb(new ClientError('Invalid network'));
|
return cb(new ClientError('Invalid network'));
|
||||||
|
|
||||||
var levels = [{
|
var levels = [{
|
||||||
name: 'emergency',
|
|
||||||
nbBlocks: 1,
|
|
||||||
modifier: 1.5,
|
|
||||||
defaultValue: 50000
|
|
||||||
}, {
|
|
||||||
name: 'priority',
|
name: 'priority',
|
||||||
nbBlocks: 1,
|
nbBlocks: 1,
|
||||||
modifier: 1,
|
defaultValue: 50000
|
||||||
defaultValue: 20000
|
|
||||||
}, {
|
}, {
|
||||||
name: 'normal',
|
name: 'normal',
|
||||||
nbBlocks: 3,
|
nbBlocks: 4,
|
||||||
modifier: 1,
|
defaultValue: 20000
|
||||||
defaultValue: 10000
|
|
||||||
}, {
|
}, {
|
||||||
name: 'economy',
|
name: 'economy',
|
||||||
nbBlocks: 10,
|
nbBlocks: 12,
|
||||||
modifier: 1,
|
defaultValue: 10000
|
||||||
defaultValue: 5000
|
|
||||||
}, ];
|
}, ];
|
||||||
|
|
||||||
var samplePoints = _.uniq(_.pluck(levels, 'nbBlocks'));
|
var samplePoints = _.uniq(_.pluck(levels, 'nbBlocks'));
|
||||||
|
@ -822,7 +814,7 @@ WalletService.prototype.getFeeLevels = function(opts, cb) {
|
||||||
feePerKB = level.defaultValue;
|
feePerKB = level.defaultValue;
|
||||||
} else {
|
} else {
|
||||||
var sample = feeSamples[level.nbBlocks];
|
var sample = feeSamples[level.nbBlocks];
|
||||||
feePerKB = (sample < 0) ? level.defaultValue : sample * level.modifier;
|
feePerKB = (sample < 0) ? level.defaultValue : sample;
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
level: level.name,
|
level: level.name,
|
||||||
|
|
|
@ -1458,7 +1458,7 @@ describe('Wallet service', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('#getFeeLevels', function() {
|
describe.only('#getFeeLevels', function() {
|
||||||
var server, wallet;
|
var server, wallet;
|
||||||
beforeEach(function(done) {
|
beforeEach(function(done) {
|
||||||
helpers.createAndJoinWallet(1, 1, function(s, w) {
|
helpers.createAndJoinWallet(1, 1, function(s, w) {
|
||||||
|
@ -1471,15 +1471,14 @@ describe('Wallet service', function() {
|
||||||
it('should get current fee levels', function(done) {
|
it('should get current fee levels', function(done) {
|
||||||
helpers.stubFeeLevels({
|
helpers.stubFeeLevels({
|
||||||
1: 40000,
|
1: 40000,
|
||||||
3: 20000,
|
4: 20000,
|
||||||
10: 18000,
|
12: 18000,
|
||||||
});
|
});
|
||||||
server.getFeeLevels({}, function(err, fees) {
|
server.getFeeLevels({}, function(err, fees) {
|
||||||
should.not.exist(err);
|
should.not.exist(err);
|
||||||
fees = _.zipObject(_.map(fees, function(item) {
|
fees = _.zipObject(_.map(fees, function(item) {
|
||||||
return [item.level, item.feePerKB];
|
return [item.level, item.feePerKB];
|
||||||
}));
|
}));
|
||||||
fees.emergency.should.equal(60000);
|
|
||||||
fees.priority.should.equal(40000);
|
fees.priority.should.equal(40000);
|
||||||
fees.normal.should.equal(20000);
|
fees.normal.should.equal(20000);
|
||||||
fees.economy.should.equal(18000);
|
fees.economy.should.equal(18000);
|
||||||
|
@ -1493,26 +1492,24 @@ describe('Wallet service', function() {
|
||||||
fees = _.zipObject(_.map(fees, function(item) {
|
fees = _.zipObject(_.map(fees, function(item) {
|
||||||
return [item.level, item.feePerKB];
|
return [item.level, item.feePerKB];
|
||||||
}));
|
}));
|
||||||
fees.emergency.should.equal(50000);
|
fees.priority.should.equal(50000);
|
||||||
fees.priority.should.equal(20000);
|
fees.normal.should.equal(20000);
|
||||||
fees.normal.should.equal(10000);
|
fees.economy.should.equal(10000);
|
||||||
fees.economy.should.equal(5000);
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('should get default fees if network cannot estimate (returns -1)', function(done) {
|
it('should get default fees if network cannot estimate (returns -1)', function(done) {
|
||||||
helpers.stubFeeLevels({
|
helpers.stubFeeLevels({
|
||||||
1: -1,
|
1: -1,
|
||||||
3: 18000,
|
4: 18000,
|
||||||
10: 0,
|
12: 0,
|
||||||
});
|
});
|
||||||
server.getFeeLevels({}, function(err, fees) {
|
server.getFeeLevels({}, function(err, fees) {
|
||||||
should.not.exist(err);
|
should.not.exist(err);
|
||||||
fees = _.zipObject(_.map(fees, function(item) {
|
fees = _.zipObject(_.map(fees, function(item) {
|
||||||
return [item.level, item.feePerKB];
|
return [item.level, item.feePerKB];
|
||||||
}));
|
}));
|
||||||
fees.emergency.should.equal(50000);
|
fees.priority.should.equal(50000);
|
||||||
fees.priority.should.equal(20000);
|
|
||||||
fees.normal.should.equal(18000);
|
fees.normal.should.equal(18000);
|
||||||
fees.economy.should.equal(0);
|
fees.economy.should.equal(0);
|
||||||
done();
|
done();
|
||||||
|
|
Loading…
Reference in New Issue