-
Notifications
You must be signed in to change notification settings - Fork 410
Handle receiving payments via Trampoline #3670
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
Changes from 1 commit
4741892
0c82cc2
a293d21
313f344
23b4c80
dc14f26
35ff142
a6f4c7f
3970f1d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1821,16 +1821,60 @@ where | |
trampoline_shared_secret, | ||
), | ||
}), | ||
Ok((_, None)) => Err(OnionDecodeErr::Malformed { | ||
err_msg: "Non-final Trampoline onion data provided to us as last hop", | ||
// todo: find more suitable error code | ||
err_code: 0x4000 | 22, | ||
}), | ||
Ok((_, Some(_))) => Err(OnionDecodeErr::Malformed { | ||
err_msg: "Final Trampoline onion data provided to us as intermediate hop", | ||
// todo: find more suitable error code | ||
err_code: 0x4000 | 22, | ||
}), | ||
Ok((msgs::InboundTrampolinePayload::BlindedForward(hop_data), None)) => { | ||
if hop_data.intro_node_blinding_point.is_some() { | ||
joostjager marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return Err(OnionDecodeErr::Relay { | ||
err_msg: "Non-final intro node Trampoline onion data provided to us as last hop", | ||
err_code: INVALID_ONION_BLINDING, | ||
Comment on lines
+1826
to
+1828
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe that using the combination of Although the spec allows zero values here, my understanding is that we still need to include the empty data? We don't hit an issue in the code today because there isn't an assertion in reason for Also totally possible that I'm missing some trampoline context, and that check should just not be added in the first place! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was ultimately resolved by switching to |
||
shared_secret, | ||
trampoline_shared_secret: Some(SharedSecret::from_bytes( | ||
trampoline_shared_secret, | ||
)), | ||
}); | ||
} | ||
Err(OnionDecodeErr::Malformed { | ||
err_msg: "Non-final Trampoline onion data provided to us as last hop", | ||
err_code: INVALID_ONION_BLINDING, | ||
}) | ||
}, | ||
Ok((msgs::InboundTrampolinePayload::BlindedReceive(hop_data), Some(_))) => { | ||
if hop_data.intro_node_blinding_point.is_some() { | ||
return Err(OnionDecodeErr::Relay { | ||
err_msg: "Final Trampoline intro node onion data provided to us as intermediate hop", | ||
err_code: 0x4000 | 22, | ||
shared_secret, | ||
trampoline_shared_secret: Some(SharedSecret::from_bytes( | ||
trampoline_shared_secret, | ||
)), | ||
}); | ||
} | ||
Err(OnionDecodeErr::Malformed { | ||
err_msg: | ||
"Final Trampoline onion data provided to us as intermediate hop", | ||
err_code: INVALID_ONION_BLINDING, | ||
}) | ||
}, | ||
Ok((msgs::InboundTrampolinePayload::Forward(_), None)) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like that these variants are spelled out explicitly now, reads more obviously correct 👍 |
||
Err(OnionDecodeErr::Relay { | ||
err_msg: "Non-final Trampoline onion data provided to us as last hop", | ||
err_code: 0x4000 | 22, | ||
shared_secret, | ||
trampoline_shared_secret: Some(SharedSecret::from_bytes( | ||
trampoline_shared_secret, | ||
)), | ||
}) | ||
}, | ||
Ok((msgs::InboundTrampolinePayload::Receive(_), Some(_))) => { | ||
Err(OnionDecodeErr::Relay { | ||
err_msg: | ||
"Final Trampoline onion data provided to us as intermediate hop", | ||
err_code: 0x4000 | 22, | ||
shared_secret, | ||
trampoline_shared_secret: Some(SharedSecret::from_bytes( | ||
trampoline_shared_secret, | ||
)), | ||
}) | ||
}, | ||
Err(e) => Err(e), | ||
} | ||
}, | ||
|
Uh oh!
There was an error while loading. Please reload this page.