Merge pull request #652 from filecoin-project/fix/sync-bugs
sync: Fix some issues
This commit is contained in:
commit
be44d7b26e
@ -108,7 +108,7 @@ type FullNodeStruct struct {
|
|||||||
StateMarketStorageDeal func(context.Context, uint64, *types.TipSet) (*actors.OnChainDeal, error) `perm:"read"`
|
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"`
|
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"`
|
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"`
|
MarketEnsureAvailable func(context.Context, address.Address, types.BigInt) error `perm:"sign"`
|
||||||
|
|
||||||
|
@ -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) {
|
return func(msg *types.Message) (bool, error) {
|
||||||
if msg.From == inmsg.From && msg.Nonce == inmsg.Nonce && !inmsg.Equals(msg) {
|
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)
|
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)
|
||||||
|
@ -84,7 +84,7 @@ func NewSyncer(sm *stmgr.StateManager, bsync *blocksync.BlockSync, self peer.ID)
|
|||||||
sm: sm,
|
sm: sm,
|
||||||
self: self,
|
self: self,
|
||||||
|
|
||||||
incoming: pubsub.New(50),
|
incoming: pubsub.New(50),
|
||||||
}
|
}
|
||||||
|
|
||||||
s.syncmgr = NewSyncManager(s.Sync)
|
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) {
|
if syncer.Genesis.Equals(maybeHead) || syncer.store.GetHeaviestTipSet().Equals(maybeHead) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -41,14 +41,20 @@ var syncStatusCmd = &cli.Command{
|
|||||||
for i, ss := range state.ActiveSyncs {
|
for i, ss := range state.ActiveSyncs {
|
||||||
fmt.Printf("worker %d:\n", i)
|
fmt.Printf("worker %d:\n", i)
|
||||||
var base, target []cid.Cid
|
var base, target []cid.Cid
|
||||||
|
var heightDiff int64
|
||||||
if ss.Base != nil {
|
if ss.Base != nil {
|
||||||
base = ss.Base.Cids()
|
base = ss.Base.Cids()
|
||||||
|
heightDiff = int64(ss.Base.Height())
|
||||||
}
|
}
|
||||||
if ss.Target != nil {
|
if ss.Target != nil {
|
||||||
target = ss.Target.Cids()
|
target = ss.Target.Cids()
|
||||||
|
heightDiff = int64(ss.Target.Height()) - heightDiff
|
||||||
|
} else {
|
||||||
|
heightDiff = 0
|
||||||
}
|
}
|
||||||
fmt.Printf("\tBase:\t%s\n", base)
|
fmt.Printf("\tBase:\t%s\n", base)
|
||||||
fmt.Printf("\tTarget:\t%s\n", target)
|
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("\tStage: %s\n", chain.SyncStageString(ss.Stage))
|
||||||
fmt.Printf("\tHeight: %d\n", ss.Height)
|
fmt.Printf("\tHeight: %d\n", ss.Height)
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,10 @@ var runCmd = &cli.Command{
|
|||||||
return err
|
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)
|
storageRepoPath := cctx.String(FlagStorageRepo)
|
||||||
r, err := repo.NewFS(storageRepoPath)
|
r, err := repo.NewFS(storageRepoPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -55,7 +55,7 @@ type storageMinerApi interface {
|
|||||||
StateMinerSectors(context.Context, address.Address, *types.TipSet) ([]*api.ChainSectorInfo, error)
|
StateMinerSectors(context.Context, address.Address, *types.TipSet) ([]*api.ChainSectorInfo, error)
|
||||||
StateMinerProvingSet(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)
|
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)
|
StateGetActor(ctx context.Context, actor address.Address, ts *types.TipSet) (*types.Actor, error)
|
||||||
StateGetReceipt(context.Context, cid.Cid, *types.TipSet) (*types.MessageReceipt, error)
|
StateGetReceipt(context.Context, cid.Cid, *types.TipSet) (*types.MessageReceipt, error)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user