Table of Contents

Class LightningSendGates

Namespace
NArk.ArkadeIntents.Lightning
Assembly
NArk.ArkadeIntents.dll

The maker's safety gates: pure decisions over a quote, an invoice and a clock.

public static class LightningSendGates
Inheritance
LightningSendGates
Inherited Members

Remarks

Kept free of I/O so each gate is testable at its exact boundary, and evaluated immediately before funding rather than at quote time — quoting and funding are separated by network waits, and a check that passed when the quote arrived can be false by the time money moves.

Fields

MinHeadroomSeconds

The minimum time that must remain before the refund path opens, in seconds.

public const long MinHeadroomSeconds = 5400

Field Value

long

Remarks

The refund deadline matures against median-time-past, which lags wall clock by roughly an hour, so a smaller margin is no margin at all.

Methods

AssertFundable(RfqQuote<LightningSendQuoteProfile>, long, long, long)

Refuse to fund unless every precondition still holds.

public static void AssertFundable(RfqQuote<LightningSendQuoteProfile> quote, long invoiceAmountSats, long invoiceExpiresAt, long now)

Parameters

quote RfqQuote<LightningSendQuoteProfile>

The solver's quote.

invoiceAmountSats long

The invoice's amount, which the solver must pay in full.

invoiceExpiresAt long

The invoice's absolute expiry, unix seconds.

now long

The current time, unix seconds.

Exceptions

LightningSendNotFundableException

A gate refused.

ResolveLockupContract(RfqQuote<LightningSendQuoteProfile>, VHTLCv2Contract, VHTLCv2Contract, bool)

Accept whichever of the maker's two derived lockup shapes matches the solver's quoted address; refuse if neither does.

public static VHTLCv2Contract ResolveLockupContract(RfqQuote<LightningSendQuoteProfile> quote, VHTLCv2Contract eightLeaf, VHTLCv2Contract nineLeaf, bool isMainnet)

Parameters

quote RfqQuote<LightningSendQuoteProfile>

The quote carrying the compare-only address.

eightLeaf VHTLCv2Contract

The candidate without the timelocked refund leaf.

nineLeaf VHTLCv2Contract

The candidate with it.

isMainnet bool

Which network's address encoding to compare under.

Returns

VHTLCv2Contract

Whichever candidate matched.

Remarks

Comparing against both, rather than a single guessed shape, is what makes this corridor tolerant of a solver on either side of the timelocked refund leaf — nothing on the wire says which it has deployed. Accepting either is safe because both pin the refund covenant to the maker's own address; what must never happen is accepting one that matches neither.

Exceptions

LockupAddressMismatchException

The quoted address matches neither candidate.