Skip to content

Commit 50f048f

Browse files
committed
better cur_block_height
1 parent 44bec16 commit 50f048f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lightning/src/ln/onion_utils.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -936,17 +936,18 @@ pub(crate) fn decode_next_payment_hop<NS: Deref>(
936936
}
937937

938938
/// Build a payment onion, returning the first hop msat and cltv values as well.
939+
/// `cur_block_height` should be set to the best known block height + 1.
939940
pub fn create_payment_onion<T: secp256k1::Signing>(
940941
secp_ctx: &Secp256k1<T>, path: &Path, session_priv: &SecretKey, total_msat: u64,
941-
recipient_onion: RecipientOnionFields, best_block_height: u32, payment_hash: &PaymentHash,
942+
recipient_onion: RecipientOnionFields, cur_block_height: u32, payment_hash: &PaymentHash,
942943
keysend_preimage: &Option<PaymentPreimage>, prng_seed: [u8; 32]
943944
) -> Result<(msgs::OnionPacket, u64, u32), APIError> {
944945
let onion_keys = construct_onion_keys(&secp_ctx, &path, &session_priv)
945946
.map_err(|_| APIError::InvalidRoute{
946947
err: "Pubkey along hop was maliciously selected".to_owned()
947948
})?;
948949
let (onion_payloads, htlc_msat, htlc_cltv) = build_onion_payloads(
949-
&path, total_msat, recipient_onion, best_block_height, keysend_preimage
950+
&path, total_msat, recipient_onion, cur_block_height, keysend_preimage
950951
)?;
951952
let onion_packet = construct_onion_packet(onion_payloads, onion_keys, prng_seed, payment_hash)
952953
.map_err(|_| APIError::InvalidRoute{

lightning/src/onion_message/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ mod functional_tests;
2828

2929
// Re-export structs so they can be imported with just the `onion_message::` module prefix.
3030
pub use self::messenger::{CustomOnionMessageHandler, DefaultMessageRouter, Destination, MessageRouter, OnionMessageContents, OnionMessagePath, OnionMessenger, PeeledOnion, PendingOnionMessage, SendError};
31-
pub use self::messenger::{create_onion_message, peel_onion_message};
3231
#[cfg(not(c_bindings))]
3332
pub use self::messenger::{SimpleArcOnionMessenger, SimpleRefOnionMessenger};
3433
pub use self::offers::{OffersMessage, OffersMessageHandler};

0 commit comments

Comments
 (0)