From 84e77f259d01e7bcff73122a2d472294908d8b27 Mon Sep 17 00:00:00 2001 From: Matt Krump Date: Thu, 14 Dec 2017 10:15:36 -0600 Subject: [PATCH] Use most recent blockNumber when blockNumber parame is nil --- cmd/get_logs/main.go | 1 + pkg/geth/geth_blockchain.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/cmd/get_logs/main.go b/cmd/get_logs/main.go index c5d5703d..cf9c8140 100644 --- a/cmd/get_logs/main.go +++ b/cmd/get_logs/main.go @@ -15,6 +15,7 @@ func main() { environment := flag.String("environment", "", "Environment name") contractHash := flag.String("contract-hash", "", "Contract hash to show summary") _blockNumber := flag.Int64("block-number", -1, "Block number of summary") + flag.Parse() config := cmd.LoadConfig(*environment) diff --git a/pkg/geth/geth_blockchain.go b/pkg/geth/geth_blockchain.go index 5fdac192..2783691f 100644 --- a/pkg/geth/geth_blockchain.go +++ b/pkg/geth/geth_blockchain.go @@ -24,6 +24,9 @@ type GethBlockchain struct { } func (blockchain *GethBlockchain) GetLogs(contract core.Contract, blockNumber *big.Int) ([]core.Log, error) { + if blockNumber == nil { + blockNumber = blockchain.latestBlock() + } contractAddress := common.HexToAddress(contract.Hash) fc := ethereum.FilterQuery{ FromBlock: blockNumber,