-
Notifications
You must be signed in to change notification settings - Fork 925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
peer: add peer_has_error #437
Conversation
This handles the case where peer->error is sometimes an empty string Fixes ElementsProject#435
hmm this made things worse 🤔 will have to think about this some more |
@@ -189,7 +189,7 @@ void peer_fail_permanent(struct peer *peer, const u8 *msg TAKES) | |||
(int)tal_len(msg), (char *)msg); | |||
|
|||
/* We can have multiple errors, eg. onchaind failures. */ | |||
if (!peer->error) | |||
if (peer_has_error(peer)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have omitted the not operator here !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch!
@@ -133,6 +133,11 @@ static inline bool peer_on_chain(const struct peer *peer) | |||
return peer_state_on_chain(peer->state); | |||
} | |||
|
|||
static inline bool peer_has_error(const struct peer *peer) | |||
{ | |||
return peer->error == NULL || peer->error[0] == '\0'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should has error be checking if peer->error is equal to NULL or not equal to NULL?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're right! brain malfunction :|
This handles the case where peer->error is sometimes an empty string
Fixes #435