Repository navigation
Refactor ChannelManager handle functions into a Channel-closing macro - #147
TheBlueMatt merged 7 commits into
Conversation
Original macro is from Antoine Riard <ariard@student.42.fr>, the error type and additional mappings are from Matt Corallo <git@bluematt.me>
Original version is from Antoine Riard <ariard@student.42.fr>, the error type and some return type fixes are from Matt Corallo <git@bluematt.me>
They are all just "its too early/late to get an announcement" errors so simply ignoring them and not sending an announce is fine
Because we've separated out channel closure from ErrorMessage returning we can return error messages in a few additional cases, like if the peer sent us a message for a channel they didn't own.
500582e to
a71abac
Compare
| err: msgs::HandleError, | ||
| needs_channel_force_close: bool, | ||
| } | ||
| impl MsgHandleErrInternal { |
There was a problem hiding this comment.
Hmmm having a builder is great to simplify errors filling but I think it's force us to specify a method for each case as a71abac shows it.
There was a problem hiding this comment.
Hmm, maybe, though I also don't want to have ErrBuilder::new().msg().action().needs_close() every time we want to return an Err cause then we spend all our charachters on a line on error handling :/. Not sure if there's a great solution here, really, but I'm open to patches to play around with it.
There was a problem hiding this comment.
Okay, c-lightning doesn't have a concept of general handle error like us.
Still not delighted by this design, but don't see better for now so will go ahead with this for channel refactoring.
There was a problem hiding this comment.
Alright, well nothing stopping us from cleaning up things with macros or flattening errors in a future PR.
This is a rebase/rewrite/extension of #140 since it was missing some stuff and I wanted to get the jump on using it to move announcement_signatures handling into it so we can finally close up BOLT 7 handling.