LocalMessageNotification replay cache configuration
LocalMessageNotification Replay Cache Configuration
Section titled “LocalMessageNotification Replay Cache Configuration”This guide describes the public replay-cache configuration for the localmessagenotification package. The cache prevents the client from delivering an accepted message ID again while its signed expiration time remains active.
Configuration
Section titled “Configuration”Create a Config with localmessagenotification.NewConfig and use localmessagenotification.WithMaxReplayEntries to set the maximum number of accepted message IDs that the client retains:
cfg := localmessagenotification.NewConfig( localmessagenotification.WithMaxReplayEntries(200000),)Config.MaxReplayEntries and WithMaxReplayEntries control the same bound:
| Setting | Behavior |
|---|---|
Omit WithMaxReplayEntries or set Config.MaxReplayEntries to 0 | The client uses the package default. |
Set WithMaxReplayEntries to a positive value | The client uses that value as the replay-cache bound. |
The default value is 31 * 4096 = 126976 entries. It covers 31 unexpired messages per stake pool for 4096 pools.
Retention and capacity
Section titled “Retention and capacity”The bound counts accepted message IDs that the client retains until their signed expiration time. The client never evicts an unexpired ID to make room for a new message. Expiration removes an ID from the retained set.
| Condition | Result |
|---|---|
The unexpired accepted IDs plus the fresh messages in the reply would exceed MaxReplayEntries | The client refuses the entire reply, delivers and records no messages from it, and returns a replay-cache-capacity error. The protocol closes the connection because it returns the error. |
After a capacity refusal, later replies remain refused until enough accepted message IDs expire to bring the retained set below the configured bound.
Docs authored by Doc Holiday