fix rpc bug

This commit is contained in:
Cassandra Heart 2024-11-06 23:04:40 -06:00
parent 80be91d067
commit 32ed742489
No known key found for this signature in database
GPG Key ID: 6352152859385958
2 changed files with 13 additions and 3 deletions

View File

@ -840,6 +840,10 @@ func (e *TokenExecutionEngine) GetRingPosition() int {
}
tries := e.clock.GetFrameProverTries()
if len(tries) <= 1 {
return -1
}
for i, trie := range tries[1:] {
if trie.Contains(altAddr.FillBytes(make([]byte, 32))) {
return i

View File

@ -166,9 +166,15 @@ func (r *RPCServer) GetNodeInfo(
if head != nil {
frame = head.FrameNumber
}
seniority := r.executionEngines[0].GetSeniority()
ring := r.executionEngines[0].GetRingPosition()
var seniority *big.Int
ring := -1
if frame > 0 {
seniority = r.executionEngines[0].GetSeniority()
ring = r.executionEngines[0].GetRingPosition()
}
if seniority == nil {
seniority = big.NewInt(0)
}
return &protobufs.NodeInfoResponse{
PeerId: peerID.String(),
MaxFrame: frame,