Skip to content

Commit 0402f25

Browse files
authored
Merge pull request #6668 from spacemeshos/node-split-poc-fix-hare-total-weight
[node-split] fix hare total weight
2 parents d90cbef + d4b6405 commit 0402f25

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

api/node/server/server.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"github.com/spacemeshos/go-spacemesh/api/node/models"
1818
"github.com/spacemeshos/go-spacemesh/common/types"
1919
"github.com/spacemeshos/go-spacemesh/hare3"
20+
"github.com/spacemeshos/go-spacemesh/hare3/eligibility"
2021
"github.com/spacemeshos/go-spacemesh/p2p/pubsub"
2122
)
2223

@@ -288,6 +289,9 @@ func (s *Server) GetHareWeightNodeIdLayer(ctx context.Context,
288289
}
289290
weight, err := s.hare.MinerWeight(ctx, id, types.LayerID(request.Layer))
290291
if err != nil {
292+
if errors.Is(err, eligibility.ErrNotActive) {
293+
return &GetHareWeightNodeIdLayer200JSONResponse{Weight: 0}, nil
294+
}
291295
return nil, fmt.Errorf("miner weight: %w", err)
292296
}
293297
return &GetHareWeightNodeIdLayer200JSONResponse{Weight: weight}, nil

systest/tests/transactions_test.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,7 @@ func testTransactions(
104104
}
105105

106106
diff := batch * amount * int(sendFor-1) * cl.Accounts()
107-
for i := 0; i < cl.Total(); i++ {
108-
client := cl.Client(i)
107+
for _, client := range nodesReceivingTxs {
109108
state := pb.NewGlobalStateServiceClient(client.PubConn())
110109
response, err := state.Account(
111110
tctx,
@@ -119,7 +118,11 @@ func testTransactions(
119118
"expected-diff", diff,
120119
"diff", after.Value-before.Value,
121120
)
122-
require.Equal(tb, int(before.Value)+diff,
123-
int(response.AccountWrapper.StateCurrent.Balance.Value), "client=%s", client.Name)
121+
require.Equal(tb,
122+
before.Value+uint64(diff),
123+
response.AccountWrapper.StateCurrent.Balance.Value,
124+
"client=%s",
125+
client.Name,
126+
)
124127
}
125128
}

0 commit comments

Comments
 (0)