Commit 73c7bd8
committed
Add MdkClient::splice_in wrapper
Wrap Node::splice_in with local validation (channel exists, channel
is usable, amount > 0) and a typed SpliceError ADT. Cache the
parsed LSP PublicKey on MdkClient so the wrapper and the upcoming
splice manager do not repeat the parse on every call.
The error mapping is the meaningful part. ldk-node's NodeError
exposes a single ChannelSplicingFailed variant for nearly every
splice failure (peer rejected, channel not yet ready, coin
selection failed under fee pressure) and InsufficientFunds for the
broad spendable-balance check. The splice manager needs to react
differently to "no funds, retry next tick" vs "something is
genuinely wrong", so the wrapper exposes the two cases as
SpliceError::InsufficientFunds and SpliceError::Rejected.
The mapping lives in a free helper (map_splice_error) rather than
a From impl. NodeError::InsufficientFunds is also produced by
open_channel and on-chain wallet paths, so a blanket From<NodeError>
for SpliceError would be wrong outside splice context. A free
function keeps the conversion's narrow scope obvious by name and
location, and avoids adding a discoverable trait impl that future
code might mistakenly use elsewhere.
ldk-node does not expose a way to distinguish the fee-too-high
coin-selection path from other ChannelSplicingFailed cases (the
detail only appears in a log line). The splice manager will treat
any Rejected as a retry candidate anyway, so we accept the lossy
mapping rather than parsing log output. Anything other than
InsufficientFunds collapses into Rejected.
ChannelNotUsable is a third, locally-detected variant. It could
have been folded into Rejected and left for ldk-node to surface,
but catching it before the network round-trip is cheaper and gives
the splice manager a clear signal that the channel was filtered
out by our own pre-check, not by the peer.
The daemon HTTP error mapper folds all SpliceError cases into
Internal for now. A future POST /splicein endpoint may want finer
status codes; the wrapper is only consumed internally by the
splice manager today, so that refinement is deferred.1 parent 49507a3 commit 73c7bd8
3 files changed
Lines changed: 98 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | | - | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
15 | | - | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| |||
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
| 37 | + | |
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
| |||
69 | 72 | | |
70 | 73 | | |
71 | 74 | | |
| 75 | + | |
| 76 | + | |
72 | 77 | | |
73 | 78 | | |
74 | 79 | | |
| |||
82 | 87 | | |
83 | 88 | | |
84 | 89 | | |
| 90 | + | |
85 | 91 | | |
86 | 92 | | |
87 | 93 | | |
| |||
115 | 121 | | |
116 | 122 | | |
117 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
118 | 168 | | |
119 | 169 | | |
120 | 170 | | |
| |||
403 | 453 | | |
404 | 454 | | |
405 | 455 | | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
16 | 46 | | |
17 | 47 | | |
18 | 48 | | |
| |||
27 | 57 | | |
28 | 58 | | |
29 | 59 | | |
| 60 | + | |
30 | 61 | | |
31 | 62 | | |
32 | 63 | | |
| |||
0 commit comments