Commit c5c479b2 authored by duanjinfei's avatar duanjinfei

add print log

parent 751ac5c3
......@@ -85,9 +85,8 @@ func (p *PullEvent) GetLogs() {
query.Addresses = p.contractList
for {
query.FromBlock = p.lastBlock
log.Info("start fileter start at ", p.lastBlock.Text(10))
height, err := p.client.BlockNumber(p.ctx)
log.Info("current node height:", height)
log.Info("Current node height:", height)
if height < p.lastBlock.Uint64() {
time.Sleep(time.Second)
continue
......@@ -101,13 +100,16 @@ func (p *PullEvent) GetLogs() {
query.FromBlock = new(big.Int).Sub(p.lastBlock, big.NewInt(backBlock))
query.ToBlock = p.lastBlock
}
log.Infof("start filter bloct at:%s, end filter block at:%s", query.FromBlock.Text(10), query.ToBlock.Text(10))
allLogs, err := p.client.FilterLogs(p.ctx, query)
if err != nil {
log.Error("filter logs failed", err)
continue
}
log.Info("Filter log length:", len(allLogs))
if len(allLogs) > 0 {
for _, vlog := range allLogs {
log.Info("Logs to be processed:", vlog)
handle, exist := p.contractHandler[vlog.Address]
if exist {
handle(vlog)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment