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
The target forgets a channel we fail with `error`, so renegotiating its temporary_channel_id was wrongly reported as reuse. A reply still in flight when the error is sent is validated against the failed negotiation instead of being reported as unknown.
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?
| /// Negotiations failed by a sent `error` whose reply may still arrive. | ||
| orphaned_accepts: OrphanedAccepts, |
There was a problem hiding this comment.
nit: Mhh, I would prefer if we could add this to negotiations somehow. I think the problem is that negotiations currently only tracks the latest negotiation per temporary_channel_id, but for orphans, we need to track "pending negotiations", too.
Maybe negotiations should be refactored to support this, instead of adding another global executor map? For example, we could use a new ChannelNegotiation struct instead of PendingChannel for negotiations:
struct ChannelNegotiation {
live: Option<PendingChannel>, // current negotiation, if any
awaiting_orphan_reply: VecDeque<PendingChannel>, // failed, reply maybe in flight
}
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