Skip to content

Commit fef6177

Browse files
committed
Document outbound payment amount invariant
Replace the success-path unwrap on payment amounts with an expect that explains why outbound payments must already have a recorded amount by the time LDK reports them as sent. Co-Authored-By: HAL 9000
1 parent 1c2db65 commit fef6177

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/event.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,8 +1092,9 @@ where
10921092
};
10931093

10941094
self.payment_store.get(&payment_id).map(|payment| {
1095-
#[allow(clippy::unwrap_used)]
1096-
let amount_msat = payment.amount_msat.unwrap();
1095+
let amount_msat = payment.amount_msat.expect(
1096+
"outbound payments should record their amount before they can succeed",
1097+
);
10971098
log_info!(
10981099
self.logger,
10991100
"Successfully sent payment of {}msat{} from \

0 commit comments

Comments
 (0)