Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: avoid panic when miner has no peer id #254

Merged
merged 1 commit into from
Nov 20, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions tasks/actorstate/miner.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func ExtractMinerInfo(a ActorInfo, ec *MinerStateExtractionContext) (*minermodel
log.Debugw("failed to decode miner multiaddr", "miner", a.Address, "multiaddress", addr, "error", err)
}
}
return &minermodel.MinerInfo{
mi := &minermodel.MinerInfo{
Height: int64(ec.CurrTs.Height()),
MinerID: a.Address.String(),
StateRoot: a.ParentStateRoot.String(),
Expand All @@ -182,10 +182,15 @@ func ExtractMinerInfo(a ActorInfo, ec *MinerStateExtractionContext) (*minermodel
NewWorker: newWorker,
WorkerChangeEpoch: int64(newInfo.WorkerChangeEpoch),
ConsensusFaultedElapsed: int64(newInfo.ConsensusFaultElapsed),
PeerID: newInfo.PeerId.String(),
ControlAddresses: newCtrlAddresses,
MultiAddresses: newMultiAddrs,
}, nil
}

if newInfo.PeerId != nil {
mi.PeerID = newInfo.PeerId.String()
}

return mi, nil
}

func ExtractMinerLockedFunds(a ActorInfo, ec *MinerStateExtractionContext) (*minermodel.MinerLockedFund, error) {
Expand Down Expand Up @@ -318,7 +323,6 @@ func ExtractMinerSectorData(ctx context.Context, ec *MinerStateExtractionContext
DealID: uint64(dealID),
})
}

}
}
sectorEventModel, err := extractMinerSectorEvents(ctx, node, a, ec, sectorChanges, preCommitChanges)
Expand Down