Skip to content

Commit

Permalink
Updating bridge before running receiveHeader test
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy-then committed Jan 3, 2024
1 parent 145f475 commit f325463
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/tests/post_iris_call_receive_header.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const expect = require('chai').expect;
const { getRskTransactionHelper } = require('../rsk-tx-helper-provider');
const { getBtcClient } = require('../btc-client-provider');
const { getBridge, getLatestActiveForkName } = require('../precompiled-abi-forks-util');
const { activateFork, sendTxWithCheck, getLatestForkName } = require('../rsk-utils');
const { activateFork, sendTxWithCheck, getLatestForkName, waitAndUpdateBridge } = require('../rsk-utils');
const { ensure0x } = require('../utils');

let rskTxHelper;
Expand All @@ -29,6 +29,9 @@ const execute = (description, getRskHost) => {

it('should return 0 and increment BTC blockchain size when calling receiveHeader method', async () => {
const cowAddress = await rskTxHelper.newAccountWithSeed('cow');

await waitAndUpdateBridge(rskTxHelper);

const blockHashes = await btcTxHelper.mine();
const blockHeader = await btcTxHelper.getBlockHeader(blockHashes[0], false);
const blockchainInitialHeigth = await bridge.methods.getBtcBlockchainBestChainHeight().call();
Expand All @@ -46,7 +49,7 @@ const execute = (description, getRskHost) => {
it('should return -1 when calling receiveHeader method consecutively', async () => {
const blockHashes = await btcTxHelper.mine();
const blockHeader = await btcTxHelper.getBlockHeader(blockHashes[0], false);
const result = await bridge.methods.receiveHeader([ensure0x(blockHeader)]).call()
const result = await bridge.methods.receiveHeader(ensure0x(blockHeader)).call();
expect(result).to.be.equal('-1');
}
);
Expand Down

0 comments on commit f325463

Please sign in to comment.