diff --git a/api/struct.go b/api/struct.go index 8276f91f2..1f08f94bd 100644 --- a/api/struct.go +++ b/api/struct.go @@ -108,7 +108,7 @@ type FullNodeStruct struct { StateMarketStorageDeal func(context.Context, uint64, *types.TipSet) (*actors.OnChainDeal, error) `perm:"read"` StateLookupID func(ctx context.Context, addr address.Address, ts *types.TipSet) (address.Address, error) `perm:"read"` StateChangedActors func(context.Context, cid.Cid, cid.Cid) (map[string]types.Actor, error) `perm:"read"` - StateGetReceipt func(context.Context, cid.Cid, *types.TipSet) (*types.MessageReceipt, error) `perm:"read"` + StateGetReceipt func(context.Context, cid.Cid, *types.TipSet) (*types.MessageReceipt, error) `perm:"read"` MarketEnsureAvailable func(context.Context, address.Address, types.BigInt) error `perm:"sign"` diff --git a/chain/events/utils.go b/chain/events/utils.go index 13d620da8..630158b13 100644 --- a/chain/events/utils.go +++ b/chain/events/utils.go @@ -30,7 +30,7 @@ func (e *calledEvents) CheckMsg(ctx context.Context, msg *types.Message, hnd Cal } } -func(e *calledEvents) MatchMsg(inmsg *types.Message) MatchFunc { +func (e *calledEvents) MatchMsg(inmsg *types.Message) MatchFunc { return func(msg *types.Message) (bool, error) { if msg.From == inmsg.From && msg.Nonce == inmsg.Nonce && !inmsg.Equals(msg) { return false, xerrors.Errorf("matching msg %s from %s, nonce %d: got duplicate origin/nonce msg %s", inmsg.Cid(), inmsg.From, inmsg.Nonce, msg.Nonce) diff --git a/chain/sync.go b/chain/sync.go index c28269c65..e1736a24d 100644 --- a/chain/sync.go +++ b/chain/sync.go @@ -84,7 +84,7 @@ func NewSyncer(sm *stmgr.StateManager, bsync *blocksync.BlockSync, self peer.ID) sm: sm, self: self, - incoming: pubsub.New(50), + incoming: pubsub.New(50), } s.syncmgr = NewSyncManager(s.Sync) @@ -429,6 +429,10 @@ func (syncer *Syncer) Sync(ctx context.Context, maybeHead *types.TipSet) error { ) } + if syncer.store.GetHeaviestTipSet().ParentWeight().GreaterThan(maybeHead.ParentWeight()) { + return nil + } + if syncer.Genesis.Equals(maybeHead) || syncer.store.GetHeaviestTipSet().Equals(maybeHead) { return nil } diff --git a/cli/sync.go b/cli/sync.go index b1b4efd0c..533a7bc9f 100644 --- a/cli/sync.go +++ b/cli/sync.go @@ -41,14 +41,20 @@ var syncStatusCmd = &cli.Command{ for i, ss := range state.ActiveSyncs { fmt.Printf("worker %d:\n", i) var base, target []cid.Cid + var heightDiff int64 if ss.Base != nil { base = ss.Base.Cids() + heightDiff = int64(ss.Base.Height()) } if ss.Target != nil { target = ss.Target.Cids() + heightDiff = int64(ss.Target.Height()) - heightDiff + } else { + heightDiff = 0 } fmt.Printf("\tBase:\t%s\n", base) fmt.Printf("\tTarget:\t%s\n", target) + fmt.Printf("\tHeight diff:\t%d\n", heightDiff) fmt.Printf("\tStage: %s\n", chain.SyncStageString(ss.Stage)) fmt.Printf("\tHeight: %d\n", ss.Height) } diff --git a/cmd/lotus-storage-miner/run.go b/cmd/lotus-storage-miner/run.go index 9a3944417..735a0d21d 100644 --- a/cmd/lotus-storage-miner/run.go +++ b/cmd/lotus-storage-miner/run.go @@ -56,6 +56,10 @@ var runCmd = &cli.Command{ return err } + if v.APIVersion != build.APIVersion { + return xerrors.Errorf("lotus-daemon API version doesn't match: local: ", api.Version{APIVersion: build.APIVersion}) + } + storageRepoPath := cctx.String(FlagStorageRepo) r, err := repo.NewFS(storageRepoPath) if err != nil { diff --git a/storage/miner.go b/storage/miner.go index fe0839467..8c2ebb546 100644 --- a/storage/miner.go +++ b/storage/miner.go @@ -55,7 +55,7 @@ type storageMinerApi interface { StateMinerSectors(context.Context, address.Address, *types.TipSet) ([]*api.ChainSectorInfo, error) StateMinerProvingSet(context.Context, address.Address, *types.TipSet) ([]*api.ChainSectorInfo, error) StateMinerSectorSize(context.Context, address.Address, *types.TipSet) (uint64, error) - StateWaitMsg(context.Context, cid.Cid) (*api.MsgWait, error) // TODO: removeme eventually + StateWaitMsg(context.Context, cid.Cid) (*api.MsgWait, error) // TODO: removeme eventually StateGetActor(ctx context.Context, actor address.Address, ts *types.TipSet) (*types.Actor, error) StateGetReceipt(context.Context, cid.Cid, *types.TipSet) (*types.MessageReceipt, error)