Skip to content

Commit 13fc473

Browse files
authored
fix: various swip21 fixes (#4874)
1 parent c127b31 commit 13fc473

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

pkg/node/node.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,12 +1031,10 @@ func NewBee(
10311031
logger.Info("updated new reserve capacity doubling height in the staking contract", "transaction", tx, "new_height", o.ReserveCapacityDoubling)
10321032
}
10331033

1034-
if o.ReserveCapacityDoubling > 0 {
1035-
// Check if the staked amount is sufficient to cover the additional neighborhoods.
1036-
// The staked amount must be at least 2^h * MinimumStake.
1037-
if stake.Cmp(big.NewInt(0).Mul(big.NewInt(1<<o.ReserveCapacityDoubling), staking.MinimumStakeAmount)) < 0 {
1038-
logger.Warning("staked amount does not sufficiently cover the additional reserve capacity. Stake should be at least 2^h * 10 BZZ, where h is the number extra doublings.")
1039-
}
1034+
// Check if the staked amount is sufficient to cover the additional neighborhoods.
1035+
// The staked amount must be at least 2^h * MinimumStake.
1036+
if o.ReserveCapacityDoubling > 0 && stake.Cmp(big.NewInt(0).Mul(big.NewInt(1<<o.ReserveCapacityDoubling), staking.MinimumStakeAmount)) < 0 {
1037+
logger.Warning("staked amount does not sufficiently cover the additional reserve capacity. Stake should be at least 2^h * 10 BZZ, where h is the number extra doublings.")
10401038
}
10411039
}
10421040
}

pkg/storageincentives/agent.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,8 @@ func (a *Agent) start(blockTime time.Duration, blocksPerRound, blocksPerPhase ui
225225
a.state.SetHealthy(a.health.IsHealthy())
226226
go a.state.purgeStaleRoundData()
227227

228-
isFrozen, err := a.redistributionStatuser.IsOverlayFrozen(ctx, block)
228+
// check if node is frozen starting from the next block
229+
isFrozen, err := a.redistributionStatuser.IsOverlayFrozen(ctx, block+1)
229230
if err != nil {
230231
a.logger.Error(err, "error checking if stake is frozen")
231232
} else {

pkg/storer/reserve.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ func (db *DB) reserveWorker(ctx context.Context) {
126126

127127
_, _ = db.countWithinRadius(ctx)
128128

129+
if !db.reserve.IsWithinCapacity() {
130+
db.events.Trigger(reserveOverCapacity)
131+
}
132+
129133
for {
130134
select {
131135
case <-ctx.Done():

0 commit comments

Comments
 (0)