Skip to main content

Configuration

Every knob has a default. Driver-wide knobs go to with_config, and per-chain ones go with the chain to with_chain:

let driver = Driver::new(ctx, client, store)
.with_config(Config {
poll_interval: Duration::from_secs(5),
..Config::default()
})
.with_chain(
Chain::Bitcoin,
esplora,
ChainConfig {
max_fee_rate: 50.0,
..ChainConfig::bitcoin()
},
)?;

Driver​

KnobDefaultEffect
poll_interval15 sThe longest a swap goes unchecked without a server signal.
server_timeout30 sHow long a server call may go unanswered before it counts as an outage.
fee_conf_target3 blocksThe confirmation target of every fee estimate.
fee_rate_cache_ttl30 sHow long a fee estimate is reused. Zero reads it every pass.
refund_timeout1 hHow long an ended SwapIn is still watched for late deposits.
max_htlc_hold1008 blocksThe longest a SwapOut's hold invoice may hold the payment. A swap whose invoice holds longer is refused at creation.
Rust

with_clock counts these deadlines on a Clock of yours instead of the system's, so a test can move time without waiting.

Per chain​

KnobBitcoinLiquidEffect
min_confs32The depth a SwapOut's funds reach before the preimage goes out, and a spend reaches before it ends a swap.
claim_margin2522520The CSV, in blocks, that must remain when a SwapOut's preimage goes out.
max_refund_csv100810080The longest CSV accepted on a SwapIn deposit. A swap with a longer one is refused at creation.
max_fee_rate1001The highest fee rate any spend pays, in sat/vB. A SwapOut holds its preimage while the estimate is above it.
block_time600 s60 sThe expected block interval, to compare a block deadline with a clock one.
funding_timeout20 min15 minFrom creation, the most a swap with nothing on chain is given. A SwapIn is refused when the server would wait less, plus time to confirm; a SwapOut when its hold invoice lasts longer.

A chain whose fee estimate cannot be read holds its swaps until it can. On regtest, which has no fee estimates, the driver takes the chain's relay minimum instead: 1 sat/vB on Bitcoin, 0.1 on Liquid.