Skip to content

Commit

Permalink
Add more logs
Browse files Browse the repository at this point in the history
  • Loading branch information
trunghai.bui committed Oct 19, 2023
1 parent b328e87 commit 91bd88b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions etherman/etherman.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,10 @@ func (etherMan *Client) updateGlobalExitRootEvent(ctx context.Context, vLog type
t := time.Unix(int64(fullBlock.Time()), 0)
block := prepareBlock(vLog, t, fullBlock)
block.GlobalExitRoots = append(block.GlobalExitRoots, gExitRoot)
log.Debugf("[UpdateGlobalExitRoot Event] gExitRoot[%v]", gExitRoot)
log.Debugf("[UpdateGlobalExitRoot Event] blockNumber[%v] gExitRoot[%+v]", vLog.BlockNumber, gExitRoot)
*blocks = append(*blocks, block)
} else if (*blocks)[len(*blocks)-1].BlockHash == vLog.BlockHash && (*blocks)[len(*blocks)-1].BlockNumber == vLog.BlockNumber {
log.Debugf("[UpdateGlobalExitRoot Event] same blockNumber[%v] gExitRoot[%+v]", vLog.BlockNumber, gExitRoot)
(*blocks)[len(*blocks)-1].GlobalExitRoots = append((*blocks)[len(*blocks)-1].GlobalExitRoots, gExitRoot)
} else {
log.Error("Error processing UpdateGlobalExitRoot event. BlockHash:", vLog.BlockHash, ". BlockNumber: ", vLog.BlockNumber)
Expand Down Expand Up @@ -240,9 +241,10 @@ func (etherMan *Client) depositEvent(ctx context.Context, vLog types.Log, blocks
}
block := prepareBlock(vLog, time.Unix(int64(fullBlock.Time()), 0), fullBlock)
block.Deposits = append(block.Deposits, deposit)
log.Debugf("[Deposit Event] deposit[%v]", deposit)
log.Debugf("[Deposit Event] blockNumber[%v] deposit[%+v]", vLog.BlockNumber, deposit)
*blocks = append(*blocks, block)
} else if (*blocks)[len(*blocks)-1].BlockHash == vLog.BlockHash && (*blocks)[len(*blocks)-1].BlockNumber == vLog.BlockNumber {
log.Debugf("[Deposit Event] new blockNumber[%v] deposit[%+v]", vLog.BlockNumber, deposit)
(*blocks)[len(*blocks)-1].Deposits = append((*blocks)[len(*blocks)-1].Deposits, deposit)
} else {
log.Error("Error processing deposit event. BlockHash:", vLog.BlockHash, ". BlockNumber: ", vLog.BlockNumber)
Expand Down Expand Up @@ -278,9 +280,10 @@ func (etherMan *Client) claimEvent(ctx context.Context, vLog types.Log, blocks *
}
block := prepareBlock(vLog, time.Unix(int64(fullBlock.Time()), 0), fullBlock)
block.Claims = append(block.Claims, claim)
log.Debugf("[Claim Event] claim[%v]", claim)
log.Debugf("[Claim Event] blockNumber[%v] claim[%+v]", vLog.BlockNumber, claim)
*blocks = append(*blocks, block)
} else if (*blocks)[len(*blocks)-1].BlockHash == vLog.BlockHash && (*blocks)[len(*blocks)-1].BlockNumber == vLog.BlockNumber {
log.Debugf("[Claim Event] new blockNumber[%v] claim[%+v]", vLog.BlockNumber, claim)
(*blocks)[len(*blocks)-1].Claims = append((*blocks)[len(*blocks)-1].Claims, claim)
} else {
log.Error("Error processing claim event. BlockHash:", vLog.BlockHash, ". BlockNumber: ", vLog.BlockNumber)
Expand Down

0 comments on commit 91bd88b

Please sign in to comment.