Skip to content

Commit

Permalink
Fix the peer_id encode error (#1268)
Browse files Browse the repository at this point in the history
  • Loading branch information
Terryhung authored Oct 4, 2023
1 parent 7326abd commit dd8217e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion model/actordumps/miner_actor_dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/filecoin-project/lily/metrics"
"github.com/filecoin-project/lily/model"
"github.com/filecoin-project/lotus/chain/types"
"github.com/libp2p/go-libp2p/core/peer"
)

type MinerActorDump struct {
Expand Down Expand Up @@ -70,7 +71,13 @@ func (m *MinerActorDump) UpdateMinerInfo(minerState miner.State) error {
return err
}

m.PeerID = string(minerInfo.PeerId)
// PeerID is bytes
if minerInfo.PeerId != nil {
newPeerID, err := peer.IDFromBytes(minerInfo.PeerId)
if err == nil {
m.PeerID = newPeerID.String()
}
}
m.WorkerID = minerInfo.Worker.String()
m.OwnerID = minerInfo.Owner.String()
m.ConsensusFaultedElapsed = int64(minerInfo.ConsensusFaultElapsed)
Expand Down

0 comments on commit dd8217e

Please sign in to comment.