Use most recent blockNumber when blockNumber parame is nil

This commit is contained in:
Matt Krump 2017-12-14 10:15:36 -06:00
parent 0e837e2d03
commit 84e77f259d
2 changed files with 4 additions and 0 deletions

View File

@ -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)

View File

@ -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,