diff --git a/apps/ecash-herald/src/chronik.js b/apps/ecash-herald/src/chronik.js --- a/apps/ecash-herald/src/chronik.js +++ b/apps/ecash-herald/src/chronik.js @@ -193,7 +193,7 @@ let guessedBlockTimestampDelta = now - guessedBlock.timestamp; // We won't keep guessing forever - const ADDITIONAL_BLOCKS_TO_GUESS = 100; + const ADDITIONAL_BLOCKS_TO_GUESS = 200; let startBlockheight; if (guessedBlockTimestampDelta > secondsAgo) { @@ -233,7 +233,14 @@ } if (typeof startBlockheight === 'undefined') { - console.log(`Did not find startBlockheight in 100 blocks`); + console.log( + `Did not find startBlockheight in ${ADDITIONAL_BLOCKS_TO_GUESS} blocks`, + ); + console.log(`Chaintip: ${chaintip}`); + console.log(`guessedBlockheight: ${guessedBlockheight}`); + console.log( + `guessedBlockTimestampDelta: ${guessedBlockTimestampDelta}`, + ); throw new Error( `Start block more than ${ADDITIONAL_BLOCKS_TO_GUESS} off our original guess`, ); diff --git a/apps/ecash-herald/test/chronik.test.js b/apps/ecash-herald/test/chronik.test.js --- a/apps/ecash-herald/test/chronik.test.js +++ b/apps/ecash-herald/test/chronik.test.js @@ -373,7 +373,7 @@ }, ); }); - it('getBlocksAgoFromChaintipByTimestamp will throw expected error if we cannot find startHeight in more than 100 guesses of more recent blocks', async function () { + it('getBlocksAgoFromChaintipByTimestamp will throw expected error if we cannot find startHeight in more than 200 guesses of more recent blocks', async function () { // Initialize chronik mock const mockedChronik = new MockChronikClient(); @@ -401,7 +401,7 @@ }); // Set 100 newer blocks, all of them still outside the window - for (let i = 0; i < 100; i += 1) { + for (let i = 0; i < 200; i += 1) { mockedChronik.setMock('block', { input: guessedBlockheight + 1 + i, output: { blockInfo: { timestamp: now - secondsAgo - 1 } }, @@ -418,11 +418,11 @@ }, { name: 'Error', - message: 'Start block more than 100 off our original guess', + message: 'Start block more than 200 off our original guess', }, ); }); - it('getBlocksAgoFromChaintipByTimestamp will throw expected error if we cannot find startHeight in more than 100 guesses of older blocks', async function () { + it('getBlocksAgoFromChaintipByTimestamp will throw expected error if we cannot find startHeight in more than 200 guesses of older blocks', async function () { // Initialize chronik mock const mockedChronik = new MockChronikClient(); @@ -449,8 +449,8 @@ output: { blockInfo: { timestamp: now - secondsAgo + 5 } }, }); - // Set 100 older blocks, all of them still within the window - for (let i = 0; i < 100; i += 1) { + // Set 200 older blocks, all of them still within the window + for (let i = 0; i < 200; i += 1) { mockedChronik.setMock('block', { input: guessedBlockheight - 1 - i, output: { blockInfo: { timestamp: now - secondsAgo + 5 } }, @@ -467,7 +467,7 @@ }, { name: 'Error', - message: 'Start block more than 100 off our original guess', + message: 'Start block more than 200 off our original guess', }, ); });