smite-ir: add SendError and SendWarning operations and generators - #257
erickcestari wants to merge 5 commits into
Conversation
|
At the current state of the PR, adding |
|
Added |
b7a03af to
d0c6472
Compare
d0c6472 to
d9951d2
Compare
| // A reply to a negotiation we failed with `error` is checked | ||
| // against it but not recorded: the target has forgotten it. | ||
| let orphan = self.orphaned_accepts.take(ac.temporary_channel_id); |
There was a problem hiding this comment.
re: #257 (comment)
A reply still in flight when the error is sent is validated against the failed negotiation instead of being reported as unknown.
I don't know how relevant this is (currently), since we don't open multiple channels afaik, but if the target never replies to the first open_channel but accepts a second open_channelwith the same temporary_channel_id, we will think the received accept_channel is orphaned:
SMITE (us) TARGET
| |
|------------ open_channel (X) ----------->|
| |
|--------------- error (X) --------------->|
| |
|------- open_channel (X, reuse) --------->|
| |
💥 |<---------- accept_channel (X) -----------|
| |
Is this a problem?
There was a problem hiding this comment.
Good catch, and it is reachable today on LDK. ldk-node accepts inbound channels manually, so accept_channel is only sent from its event task, and our error removes the pending request first. Since requests are keyed by temporary_channel_id, the stale event then accepts the reused open_channel. We get a single accept_channel answering the second open. LND and CLN answer synchronously, and Eclair drops an error for a channel it hasn't spawned yet, so they still answer the first one.
The reply now answers the first negotiation it is valid for (orphans oldest first, then live), and skipped orphans are dropped. When it is valid for both we can't tell, so it counts as the orphan's reply. That only costs depth, not a false positive.
dbb6ca6 to
7804af1
Compare
…ndError The target forgets a channel we fail with `error`, so renegotiating its temporary_channel_id or reusing its funding outpoint was wrongly reported as reuse or a duplicate funding_signed. A reply still in flight when the error is sent is validated against the failed channel instead of being reported as unknown.
7804af1 to
f95907e
Compare
Adds
SendErrorandSendWarningoperations plus a generator for each, so programs can send BOLT 1errorandwarningmessages and exercise the target's error handling and force-close paths. The generators use the all-zerochannel_idone time in four to cover the "all channels" case.Closes #256