diff --git a/chain/stmgr/utils.go b/chain/stmgr/utils.go index 81900cdfc..5381f9c47 100644 --- a/chain/stmgr/utils.go +++ b/chain/stmgr/utils.go @@ -2,7 +2,15 @@ package stmgr import ( "context" + "os" + cid "github.com/ipfs/go-cid" + blockstore "github.com/ipfs/go-ipfs-blockstore" + cbor "github.com/ipfs/go-ipld-cbor" + cbg "github.com/whyrusleeping/cbor-gen" + "golang.org/x/xerrors" + + "github.com/filecoin-project/go-address" amt "github.com/filecoin-project/go-amt-ipld/v2" "github.com/filecoin-project/sector-storage/ffiwrapper" "github.com/filecoin-project/specs-actors/actors/abi" @@ -14,8 +22,6 @@ import ( "github.com/filecoin-project/specs-actors/actors/crypto" "github.com/filecoin-project/specs-actors/actors/util/adt" - "github.com/filecoin-project/go-address" - "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/chain/state" @@ -23,12 +29,6 @@ import ( "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/vm" "github.com/filecoin-project/lotus/node/modules/dtypes" - - cid "github.com/ipfs/go-cid" - blockstore "github.com/ipfs/go-ipfs-blockstore" - cbor "github.com/ipfs/go-ipld-cbor" - cbg "github.com/whyrusleeping/cbor-gen" - "golang.org/x/xerrors" ) func GetNetworkName(ctx context.Context, sm *StateManager, st cid.Cid) (dtypes.NetworkName, error) { @@ -473,7 +473,11 @@ func MinerGetBaseInfo(ctx context.Context, sm *StateManager, tsk types.TipSetKey prev, err := sm.ChainStore().GetLatestBeaconEntry(ts) if err != nil { - return nil, xerrors.Errorf("failed to get latest beacon entry: %w", err) + if os.Getenv("LOTUS_IGNORE_DRAND") != "_yes_" { + return nil, xerrors.Errorf("failed to get latest beacon entry: %w", err) + } + + prev = &types.BeaconEntry{} } worker, err := sm.ResolveToKeyAddress(ctx, mas.GetWorker(), ts) diff --git a/chain/store/store.go b/chain/store/store.go index d58d8cf2d..63df6d7d9 100644 --- a/chain/store/store.go +++ b/chain/store/store.go @@ -6,6 +6,7 @@ import ( "encoding/binary" "encoding/json" "io" + "os" "sync" "github.com/filecoin-project/specs-actors/actors/crypto" @@ -1114,6 +1115,12 @@ func (cs *ChainStore) GetLatestBeaconEntry(ts *types.TipSet) (*types.BeaconEntry cur = next } + if os.Getenv("LOTUS_IGNORE_DRAND") == "_yes_" { + return &types.BeaconEntry{ + Data: []byte{9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9}, + }, nil + } + return nil, xerrors.Errorf("found NO beacon entries in the 20 blocks prior to given tipset") }