Skip to content

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.

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:

SettingBehavior
Omit WithMaxReplayEntries or set Config.MaxReplayEntries to 0The client uses the package default.
Set WithMaxReplayEntries to a positive valueThe 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.

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.

ConditionResult
The unexpired accepted IDs plus the fresh messages in the reply would exceed MaxReplayEntriesThe 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.


Doc Holiday logo

Docs authored by Doc Holiday