Skip to content

fix: safe reserve capacity doubling with runtime monitor on insufficient stake#5315

Open
martinconic wants to merge 2 commits intomasterfrom
update-height-on-doubling
Open

fix: safe reserve capacity doubling with runtime monitor on insufficient stake#5315
martinconic wants to merge 2 commits intomasterfrom
update-height-on-doubling

Conversation

@martinconic
Copy link
Contributor

Checklist

  • I have read the coding guide.
  • My change requires a documentation update, and I have done it.
  • I have added tests to cover my changes.
  • I have filled out the description and linked the related issues.

Description

  1. On startup, if the node has insufficient stake for the configured ReserveCapacityDoubling, it now logs a warning and skips the on-chain UpdateHeight transaction. The node starts with the increased local capacity but without redistribution rewards.
  2. Adds a background worker that checks the wallet balance every 10 minutes. If the stake is topped up to the required amount, it automatically triggers the UpdateHeight transaction to upgrade the node's status on-chain (noting that this triggers the standard freeze period ~ 2 rounds).

Open API Spec Version Changes (if applicable)

Motivation and Context (Optional)

Related Issue (Optional)

Screenshots (if appropriate):

@acud acud added this to the v2.8.0 milestone Feb 4, 2026
@martinconic martinconic marked this pull request as ready for review February 9, 2026 18:07
@gacevicljubisa
Copy link
Member

Instead of polling every 10 minutes, we should trigger UpdateHeight directly from stakingDepositHandler after a successful DepositStake. Staking can only happen via the API POST /stake/deposit/{amount}, so we already know exactly when the stake changes — there's no need to poll the chain for something we initiated ourselves.

The only case polling would cover is if someone stakes directly on the smart contract bypassing the bee API, but that's not a supported workflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants