Skip to content

Make field error of ErrorPacket (former HandleError) mandatory #390

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

Merged
merged 2 commits into from
Nov 15, 2019

Conversation

ariard
Copy link

@ariard ariard commented Nov 6, 2019

First step in a set of PRs to simplify our errors handling.

@TheBlueMatt
Copy link
Collaborator

Fuck yes! rust-lightning finally growing up :).

Not sure about the name ErrorPacket, though, seems to imply sending a message on the wire or so. Maybe something even more generic like LightningError or just crate::Error?

@ariard ariard force-pushed the 2019-11-consistent-errors branch 2 times, most recently from 130c82f to 6e78406 Compare November 12, 2019 22:42
@ariard
Copy link
Author

ariard commented Nov 12, 2019

LightningError won by default of better name.

Copy link
Collaborator

@TheBlueMatt TheBlueMatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK if you change the one comment to an Ignore.

src/ln/router.rs Outdated
@@ -404,13 +404,13 @@ macro_rules! secp_verify_sig {
( $secp_ctx: expr, $msg: expr, $sig: expr, $pubkey: expr ) => {
match $secp_ctx.verify($msg, $sig, $pubkey) {
Ok(_) => {},
Err(_) => return Err(HandleError{err: "Invalid signature from remote node", action: None}),
Err(_) => return Err(LightningError{err: "Invalid signature from remote node", action: ErrorAction::SendErrorMessage { msg: ErrorMessage { channel_id: [0;32], data: "Invalid signature".to_string() }}}),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmmmmmm I really dont know how I feel about this. Does it really make sense to force-close all our channels with this peer because they sent us an invalid gossip message (also, do we properly handle this - dont we need to do force-closing on our end to send an ErrorMessage with a null channel_id, too?)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we follow specs that the behavior to do:

if bitcoin_signature_1, bitcoin_signature_2, node_signature_1 OR node_signature_2 are invalid OR NOT correct: SHOULD fail the connection.

But we may have peer on the network being more liberal and not doing their sanitize of third-party messages cleanly so we can be liberal too for now and have better error handling latter (with maybe new error actions for Router, like ban peer only if send more than X wrong-sigs channel announcements)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, and Error like that implies maybe closing channels with that peer, which is confusing, and, honestly, probably not what we want to do.

@ariard ariard force-pushed the 2019-11-consistent-errors branch from 6e78406 to f3c4758 Compare November 15, 2019 21:16
We also fulfilled last empty ErrorAction:
- Router secp fail : IgnoreError
- processing error in Router : IgnoreError
- get_channel_update too early : IgnoreError
@ariard ariard force-pushed the 2019-11-consistent-errors branch from f3c4758 to ddbe53f Compare November 15, 2019 21:25
@TheBlueMatt TheBlueMatt merged commit 2e1b7ab into lightningdevkit:master Nov 15, 2019
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