Expand description
§Auto Funding Strategy
This strategy listens for channel state change events to check whether a channel has dropped below
min_stake_threshold HOPR. If this happens, the strategy issues a fund channel transaction to re-stake the
channel with funding_amount HOPR.
Additionally, the strategy periodically scans all outgoing open channels on each tick and funds any that have fallen below the threshold. This catches channels opened with low balance and channels that were underfunded when the node started.
§In-flight tracking
To prevent duplicate funding when multiple balance-decrease events arrive in quick succession, the strategy maintains a set of channel IDs currently being funded. A channel is added to the set when a funding tx is successfully enqueued, and removed when:
- The spawned confirmation task observes a transaction failure,
- A balance increase event is observed for that channel (indicating the funding confirmed), or
- An
on_tickscan finds the channel’s balance has risen above the threshold.
§Metrics
hopr_strategy_auto_funding_funding_count— incremented when a funding tx is successfully enqueuedhopr_strategy_auto_funding_failure_count— incremented when a funding tx fails to enqueue or confirm
For details on default parameters see AutoFundingStrategyConfig.
Structs§
- Auto
Funding Strategy - The
AutoFundingStrategyautomatically funds a channel that dropped its staked balance below the configured threshold. - Auto
Funding Strategy Config - Configuration for
AutoFundingStrategy - METRIC_
COUNT_ 🔒AUTO_ FUNDINGS - METRIC_
COUNT_ 🔒AUTO_ FUNDING_ FAILURES
Functions§
- validate_
funding_ 🔒amount - Validates that
AutoFundingStrategyConfig::funding_amountis non-zero.