From 462312f2e8a8274c434789e16936864b53c78ca4 Mon Sep 17 00:00:00 2001 From: venkatesh mankena Date: Sun, 10 May 2020 11:44:06 +0530 Subject: [PATCH] MAT-1132 - fix review comments --- bridge/setu/listener/rootchain.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bridge/setu/listener/rootchain.go b/bridge/setu/listener/rootchain.go index e31ad8113..e559b86ee 100644 --- a/bridge/setu/listener/rootchain.go +++ b/bridge/setu/listener/rootchain.go @@ -101,10 +101,12 @@ func (rl *RootChainListener) ProcessHeader(newHeader *types.Header) { // confirmation confirmationBlocks := big.NewInt(0).SetUint64(requiredConfirmations) - confirmationBlocks = confirmationBlocks.Add(confirmationBlocks, big.NewInt(1)) - if latestNumber.Uint64() > confirmationBlocks.Uint64() { - latestNumber = latestNumber.Sub(latestNumber, confirmationBlocks) + + if latestNumber.Cmp(confirmationBlocks) <= 0 { + rl.Logger.Error("Block number less than Confirmations required", "blockNumber", latestNumber.Uint64, "confirmationsRequired", confirmationBlocks.Uint64) + return } + latestNumber = latestNumber.Sub(latestNumber, confirmationBlocks) // default fromBlock fromBlock := latestNumber