Skip to content
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

Closed
wants to merge 1 commit into from
Closed

Conversation

jb55
Copy link
Collaborator

@jb55 jb55 commented Dec 13, 2017

This handles the case where peer->error is sometimes an empty string

Fixes #435

This handles the case where peer->error is sometimes an empty string

Fixes ElementsProject#435
@jb55
Copy link
Collaborator Author

jb55 commented Dec 13, 2017

hmm this made things worse 🤔 will have to think about this some more

@jb55 jb55 closed this Dec 13, 2017
@@ -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))
Copy link

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 !

Copy link
Collaborator Author

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';
Copy link

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?

Copy link
Collaborator Author

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 :|

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants