MPP.Methods.XRPL.RedeemLock (mpp v0.18.0)

Copy Markdown View Source

Single-node exclusive lease for XRPL PaymentChannelClaim submits.

Sequence is an account-wide nonce: a transaction is only valid when it equals the sending account's current Sequence (Transaction Common Fields). Two claims from the same Destination that pick the same Sequence collide; the loser fails tefPAST_SEQ (tef codes).

with_account/3 takes an ETS lease keyed by Destination address so concurrent redeem/2 calls on one BEAM node cannot share a Sequence. MPP.Methods.XRPL.Session also leases "channel:" <> channel_id in the same table so one channel is redeemed once at a time. Acquisition is bounded by a timeout; the lease is not visible to other nodes.

Summary

Functions

Returns a specification to start this module under a supervisor.

Start the ETS table owner for Destination-account leases.

Run fun while holding the exclusive lease for address.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(opts)

@spec start_link(keyword()) :: GenServer.on_start()

Start the ETS table owner for Destination-account leases.

with_account(address, fun, timeout_ms \\ 30000)

@spec with_account(String.t(), (-> result), non_neg_integer()) ::
  result | {:error, MPP.Errors.t()}
when result: var

Run fun while holding the exclusive lease for address.

Not re-entrant. Acquisition is bounded by timeout_ms (default 30,000). Waiters monitor a lease process that exits on release or caller death.