Commit 29d5085a authored by Cédric Moreau's avatar Cédric Moreau
Browse files

[enh] #847 Missing division by (dtReeval / dt)

parent 5b54523c
......@@ -840,7 +840,7 @@ const indexer = module.exports = {
} else if (HEAD.udReevalTime != HEAD_1.udReevalTime) {
// DUG
const previousUB = HEAD_1.unitBase;
HEAD.dividend = Math.ceil(HEAD_1.dividend + Math.pow(conf.c, 2) * Math.ceil(HEAD_1.mass / Math.pow(10, previousUB)) / HEAD.membersCount);
HEAD.dividend = Math.ceil(HEAD_1.dividend + Math.pow(conf.c, 2) * Math.ceil(HEAD_1.mass / Math.pow(10, previousUB)) / HEAD.membersCount / (conf.dtReeval / conf.dt));
} else {
HEAD.dividend = HEAD_1.dividend;
}
......
......@@ -25,7 +25,7 @@ describe("Protocol BR_G13 - dividend", function(){
}));
it('block with medianTime == udTime', () => co(function*(){
const conf = { dt: 100, c: 0.0488 };
const conf = { dt: 100, dtReeval: 100, c: 0.0488 };
const HEAD_1 = { number: 59, udTime: 1500000900, udReevalTime: 1500000900, dividend: 100, mass: 18000, unitBase: 1 };
const HEAD = { number: 60, medianTime: 1500000900, membersCount: 3 };
indexer.prepareUDTime(HEAD, HEAD_1, conf);
......@@ -35,7 +35,7 @@ describe("Protocol BR_G13 - dividend", function(){
}));
it('block with medianTime > udTime', () => co(function*(){
const conf = { dt: 100, c: 0.0488 };
const conf = { dt: 100, dtReeval: 100, c: 0.0488 };
const HEAD_1 = { number: 59, udTime: 1500000900, udReevalTime: 1500000900, dividend: 100, mass: 18000, unitBase: 1 };
const HEAD = { number: 60, medianTime: 1500000901, membersCount: 3 };
indexer.prepareUDTime(HEAD, HEAD_1, conf);
......
......@@ -78,10 +78,10 @@ describe("Protocol 1.0 Dividend Update", function() {
}));
it('should have block#8 with UD 1010', () => s1.expectThat('/blockchain/block/8', (json) => {
json.dividend.should.equal(1010);
json.dividend.should.equal(1002);
}));
it('should have block#9 with UD 1010', () => s1.expectThat('/blockchain/block/9', (json) => {
json.dividend.should.equal(1010);
json.dividend.should.equal(1002);
}));
});
......@@ -80,13 +80,13 @@ describe("Protocol 1.0 Ğ1 Dividend", function() {
json.should.have.property('medianTime').equal(start + aDay * 11); // 2016-03-20 12:00:00 UTC+0
}));
it('should have block#13 with UD 1027', () => s1.expectThat('/blockchain/block/13', (json) => {
json.dividend.should.equal(1027);
it('should have block#13 with UD 1001', () => s1.expectThat('/blockchain/block/13', (json) => {
json.dividend.should.equal(1001);
json.should.have.property('medianTime').equal(start + aDay * 12); // 2016-03-21 12:00:00 UTC+0
}));
it('should have block#14 with UD 1027', () => s1.expectThat('/blockchain/block/14', (json) => {
json.dividend.should.equal(1027);
it('should have block#14 with UD 1001', () => s1.expectThat('/blockchain/block/14', (json) => {
json.dividend.should.equal(1001);
json.should.have.property('medianTime').equal(start + aDay * 13); // 2016-03-22 12:00:00 UTC+0
}));
});
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment