From 9b199f0476869a8ece108061a07268a0f1d99eb9 Mon Sep 17 00:00:00 2001 From: leviok Date: Tue, 29 Sep 2020 09:37:47 +0800 Subject: [PATCH 1/3] fix nil pointer --- node/impl/full/state.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/node/impl/full/state.go b/node/impl/full/state.go index 5e01eaa5bd6..fc1c6914ce8 100644 --- a/node/impl/full/state.go +++ b/node/impl/full/state.go @@ -792,6 +792,8 @@ func (a *StateAPI) StateSectorPreCommitInfo(ctx context.Context, maddr address.A pci, err := stmgr.PreCommitInfo(ctx, a.StateManager, maddr, n, ts) if err != nil { return miner.SectorPreCommitOnChainInfo{}, err + } else if pci == nil { + return miner.SectorPreCommitOnChainInfo{}, nil } return *pci, err From 9fe3649dd2ff2719ed9d9475656eb0e5ec514cef Mon Sep 17 00:00:00 2001 From: leviok Date: Fri, 23 Oct 2020 16:49:49 +0800 Subject: [PATCH 2/3] correct it --- node/impl/full/state.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/impl/full/state.go b/node/impl/full/state.go index fc1c6914ce8..415eea7dabe 100644 --- a/node/impl/full/state.go +++ b/node/impl/full/state.go @@ -793,7 +793,7 @@ func (a *StateAPI) StateSectorPreCommitInfo(ctx context.Context, maddr address.A if err != nil { return miner.SectorPreCommitOnChainInfo{}, err } else if pci == nil { - return miner.SectorPreCommitOnChainInfo{}, nil + return nil, xerrors.Errorf("precommit info is not exists") } return *pci, err From 7d540905acb171f55eed33e6347314527a234908 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 23 Nov 2020 12:14:49 +0100 Subject: [PATCH 3/3] Don't return nil in StateSectorPreCommitInfo --- node/impl/full/state.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/impl/full/state.go b/node/impl/full/state.go index 415eea7dabe..3ffe7b6b793 100644 --- a/node/impl/full/state.go +++ b/node/impl/full/state.go @@ -793,7 +793,7 @@ func (a *StateAPI) StateSectorPreCommitInfo(ctx context.Context, maddr address.A if err != nil { return miner.SectorPreCommitOnChainInfo{}, err } else if pci == nil { - return nil, xerrors.Errorf("precommit info is not exists") + return miner.SectorPreCommitOnChainInfo{}, xerrors.Errorf("precommit info is not exists") } return *pci, err