From 65def6cc587fb54815fb502a78c234eb2583bc73 Mon Sep 17 00:00:00 2001 From: whyrusleeping Date: Wed, 2 Oct 2019 12:00:08 -0600 Subject: [PATCH] handle getting state for genesis block --- chain/stmgr/stmgr.go | 5 +++++ node/impl/full/mpool.go | 1 + 2 files changed, 6 insertions(+) diff --git a/chain/stmgr/stmgr.go b/chain/stmgr/stmgr.go index 98e386658..7361f363a 100644 --- a/chain/stmgr/stmgr.go +++ b/chain/stmgr/stmgr.go @@ -59,6 +59,11 @@ func (sm *StateManager) TipSetState(cids []cid.Cid) (cid.Cid, cid.Cid, error) { return cid.Undef, cid.Undef, err } + if ts.Height() == 0 { + // NB: Genesis block is a weird case here... + return ts.Blocks()[0].ParentStateRoot, ts.Blocks()[0].ParentMessageReceipts, nil + } + st, rec, err := sm.computeTipSetState(ctx, ts.Blocks(), nil) if err != nil { return cid.Undef, cid.Undef, err diff --git a/node/impl/full/mpool.go b/node/impl/full/mpool.go index ee9613b88..bd852a2f8 100644 --- a/node/impl/full/mpool.go +++ b/node/impl/full/mpool.go @@ -2,6 +2,7 @@ package full import ( "context" + "go.uber.org/fx" "golang.org/x/xerrors"