Documentation
¶
Overview ¶
Package batchtrigger evaluates an operator-supplied CEL formula that decides whether the server should start a new batch round.
The package mirrors the pattern used by pkg/ark-lib/arkfee for fee programs: programs are compiled once via Parse, then evaluated against a Context snapshot. A nil Trigger is always permissive (returns true) so that callers can keep batch behaviour unchanged when no formula is configured.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct {
// IntentsCount is the number of pending intents queued.
IntentsCount int64
// CurrentFeerate is the current mempool fee rate in sat/kvbyte
// (matches ports.WalletService.FeeRate).
CurrentFeerate uint64
// TimeSinceLastBatch is the number of seconds elapsed since the last batch
// was finalized. It is 0 when no batch has been finalized yet since the
// server started.
TimeSinceLastBatch int64
// BoardingInputsCount is the total number of pending boarding UTXOs across
// all queued intents.
BoardingInputsCount int64
// TotalBoardingAmount is the total amount in satoshis across all pending
// boarding UTXOs.
TotalBoardingAmount uint64
// TotalIntentFees is the total implicit fees in satoshis across all pending
// intents (sum of (input amounts) - (output amounts) per intent).
TotalIntentFees uint64
}
Context is the snapshot of state passed to a batch_trigger program when it is evaluated. Every field maps 1:1 to a CEL variable declared in pkg/ark-lib/batchtrigger/celenv.
type Trigger ¶
type Trigger struct {
// contains filtered or unexported fields
}
Trigger wraps a compiled CEL program and the original source text.
func New ¶
New parses the supplied program text against the batch_trigger CEL environment. An empty string returns (nil, nil) so callers can treat the gate as "always allow" without special-casing.