mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 18:11:28 +01:00
htlc: Return an invalid payload error if payload is invalid
We somehow were always returning `badonion` when really it is an invalid payload inside the onion.
This commit is contained in:
parent
959687bf6d
commit
ac5cba2243
@ -981,9 +981,12 @@ htlc_accepted_hook_callback(struct htlc_accepted_hook_payload *request,
|
||||
case htlc_accepted_continue:
|
||||
/* *Now* we barf if it failed to decode */
|
||||
if (!request->payload) {
|
||||
log_debug(channel->log, "Failing HTLC because of an invalid payload");
|
||||
local_fail_in_htlc_badonion(hin,
|
||||
WIRE_INVALID_ONION_PAYLOAD);
|
||||
log_debug(channel->log,
|
||||
"Failing HTLC because of an invalid payload");
|
||||
local_fail_in_htlc(hin,
|
||||
take(towire_invalid_onion_payload(
|
||||
NULL, request->failtlvtype,
|
||||
request->failtlvpos)));
|
||||
} else if (rs->nextcase == ONION_FORWARD) {
|
||||
forward_htlc(hin, hin->cltv_expiry,
|
||||
request->payload->amt_to_forward,
|
||||
|
@ -2806,7 +2806,6 @@ caused a crash in 0.8.0, so we then disallowed it.
|
||||
assert inv['amount_received_msat'] == Millisatoshi(1001)
|
||||
|
||||
|
||||
@pytest.mark.xfail(strict=True)
|
||||
def test_reject_invalid_payload(node_factory):
|
||||
"""Send an onion payload with an unknown even type.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user