Skip to content

Commit

Permalink
Merge branch 'POS90'
Browse files Browse the repository at this point in the history
  • Loading branch information
ibudisteanu committed Jul 20, 2020
2 parents f002df6 + dcc73e2 commit db2bf1e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class BlockchainDifficulty{

//avoid first Block, because the firstBlock is correlated with the last block of the POW
const PoSModulo = BlockchainGenesis.PoSModulo(blockNumber);
if ( PoSModulo && (blockNumber+1) % PoSModulo === 0 ) firstBlock += 1
if ( PoSModulo && ((blockNumber+1) % PoSModulo === 0) ) firstBlock += 1

//adding blocks 0..8
for (let i = firstBlock; i < blockNumber; i++) {
Expand Down Expand Up @@ -129,7 +129,7 @@ class BlockchainDifficulty{

//avoid first Block, because the firstBlock is correlated with the last block of the POW
const PoSModulo = BlockchainGenesis.PoSModulo(blockNumber);
if ( PoSModulo && (blockNumber+1) % PoSModulo === 0 ) firstBlock += 1
if ( PoSModulo && (blockNumber+1) % PoSModulo === 10 ) firstBlock += 1

//adding blocks 0..8
for (let i = firstBlock; i < blockNumber; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ class PPoWBlockchainBlock extends InterfaceBlockchainBlock{
for (let i = 0; i < interlink.length; i++) {

if (interlink[i].height !== this.interlink[i].height)
throw {message: "interlink height is different"};
throw {message: "interlink height is different", interlink:i , height: this.height};

if (!BufferExtended.safeCompare(interlink[i].blockId, this.interlink[i].blockId))
throw {message: "interlink prevBlock height is different"};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ describe('test PPoW-Blockchain interlink data structure', () => {
let serializedBuffer = block._serializeInterlink();
block._deserializeInterlink(serializedBuffer, 0);

assert(block.interlink.length === interlink.length, "Interlink length differ: " + block.interlink.length + "!==" + interlink.length);
assert(block.interlink.length === interlink.length, "Interlink length diffent: " + block.interlink.length + "!==" + interlink.length);

for (let i = 0; i < interlink.length; ++i) {
assert(block.interlink[i].height === interlink[i].height, "Interlink height differ: " + block.interlink[i].height + "!==" + interlink[i].height);
assert(block.interlink[i].blockId.equals(interlink[i].blockId), "Interlink blockId differ: " + block.interlink[i].blockId.toString("hex") + "!==" + interlink[i].blockId.toString("hex") + "i = " + i);
assert(block.interlink[i].height === interlink[i].height, "Interlink height diffent: " + block.interlink[i].height + "!==" + interlink[i].height);
assert(block.interlink[i].blockId.equals(interlink[i].blockId), "Interlink blockId diffent: " + block.interlink[i].blockId.toString("hex") + "!==" + interlink[i].blockId.toString("hex") + "i = " + i);
}

});
Expand Down

0 comments on commit db2bf1e

Please sign in to comment.