Skip to content

Commit c077136

Browse files
committed
f: avoid unwrap for empty last_hop_id
1 parent 628c757 commit c077136

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lightning/src/ln/onion_utils.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,13 @@ where
527527
);
528528
}
529529
} else {
530-
let payload = OP::new_forward(last_hop_id.unwrap(), value_msat, cltv);
530+
let payload = OP::new_forward(
531+
last_hop_id.ok_or(APIError::InvalidRoute {
532+
err: "Next hop ID must be known for non-final hops".to_string(),
533+
})?,
534+
value_msat,
535+
cltv,
536+
);
531537
callback(PayloadCallbackAction::PushFront, payload);
532538
}
533539
cur_value_msat += hop.fee_msat();

0 commit comments

Comments
 (0)