Skip to content

Commit

Permalink
chore(test): add case for validating parent hash
Browse files Browse the repository at this point in the history
  • Loading branch information
sdaveas committed Aug 23, 2024
1 parent be9f5c2 commit dfbc3ea
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/RpcCompatibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,19 @@ describe('RpcCompatibility', () => {
checkBlock(block, false);
checkBlockTimeStamp(parseInt(block.timestamp, 16), 12000);
});

it('blocks have valid parent hashes', async () => {
const withTransaction = false;
const block = await provider.send('eth_getBlockByNumber', ['latest', withTransaction]);
const parentBlock = await provider.send('eth_getBlockByHash', [block.parentHash, withTransaction]);

console.log('Block:', block);
console.log('Parent block:', parentBlock);

checkBlock(parentBlock, withTransaction);

expect(parentBlock.hash).to.equal(block.parentHash);
});
});

it('should support RPC method eth_blockNumber', async () => {
Expand Down

0 comments on commit dfbc3ea

Please sign in to comment.