Commit 2165ca5
committed
Wire destination-aware max_sendable via find_route
The reported fee budget is built from
route.get_total_fees(), which is what LDK itself would charge for
a send of that size. Slightly conservative: total_fees is computed
from the full balance so with the sent amount they will be less.
This provides a buffer and could be tweaked by iterating the estimate.
On top of total_fees the budget applies a multiplier. The chosen route
can fail at send time and LDK retries along a more expensive path. A
multiplier scales with the original route's cost so retries can
actually reach those alternatives. Exposed as
route_retry_fee_multiplier_bps so operators can trade reported max
sendable for payment success rate. Starting low to minimise headroom
left on the table; bump up if production retries surface
"insufficient fee budget" failures too often.
FixedAmount returns Err(FixedAmount { amount_msat }) because there's
nothing to estimate when the payee dictates the amount; the variant
carries the amount so callers don't re-extract it.
BOLT12 offers, LNURL-pay, and HRN destinations fall back to the
simple buffer for now. BOLT12 needs the invoice (not the offer) for
from_bolt12_invoice, which depends on the invoice fetch deferred
upstream. LNURL-pay and HRN need to resolve into a concrete invoice
first; that resolution will move into this module shortly.
BOLT11 round-trips through its bech32 string: bitcoin-payment-
instructions pins upstream rust-lightning's Bolt11Invoice while
ldk-node pulls the moneydevkit fork. Wire-compatible, distinct types.
A re-parse failure falls back to Buffer rather than panicking.1 parent 69b3d9d commit 2165ca5
3 files changed
Lines changed: 323 additions & 109 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
99 | 100 | | |
100 | 101 | | |
101 | 102 | | |
| |||
190 | 191 | | |
191 | 192 | | |
192 | 193 | | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
193 | 197 | | |
194 | 198 | | |
195 | 199 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
150 | | - | |
| 149 | + | |
| 150 | + | |
151 | 151 | | |
152 | | - | |
153 | | - | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
154 | 155 | | |
155 | 156 | | |
156 | 157 | | |
157 | 158 | | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | 159 | | |
164 | 160 | | |
165 | 161 | | |
166 | 162 | | |
167 | 163 | | |
168 | 164 | | |
169 | | - | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
170 | 172 | | |
171 | 173 | | |
172 | 174 | | |
| |||
0 commit comments