Use UserRequestForInformation as starting block for InformationRetrieved search

This commit is contained in:
Kirill Fedoseev 2021-07-13 11:32:51 +03:00
parent a1e258f424
commit a973e23a9e
2 changed files with 13 additions and 3 deletions

@ -6,7 +6,16 @@ const logger = require('../../services/logger').child({
const { strip0x } = require('../../../../commons')
const { AMB_AFFIRMATION_REQUEST_EXTRA_GAS_ESTIMATOR: estimateExtraGas } = require('../../utils/constants')
async function estimateGas({ web3, homeBridge, validatorContract, messageId, status, result, address }) {
async function estimateGas({
web3,
homeBridge,
validatorContract,
messageId,
status,
result,
address,
homeBlockNumber
}) {
try {
const gasEstimate = await homeBridge.methods.confirmInformation(messageId, status, result).estimateGas({
from: address
@ -53,7 +62,7 @@ async function estimateGas({ web3, homeBridge, validatorContract, messageId, sta
logger.debug('Check if InformationRetrieved event for this message already exists')
const logs = await homeBridge.getPastEvents('InformationRetrieved', {
fromBlock: '0',
fromBlock: homeBlockNumber,
toBlock: 'latest',
filter: { messageId }
})

@ -97,7 +97,8 @@ function processInformationRequestsBuilder(config) {
messageId,
status,
result,
address: config.validatorAddress
address: config.validatorAddress,
homeBlockNumber: homeBlock.number
})
logger.debug({ gasEstimate }, 'Gas estimated')
} catch (e) {