@@ -936,17 +936,18 @@ pub(crate) fn decode_next_payment_hop<NS: Deref>(
936
936
}
937
937
938
938
/// 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.
939
940
pub fn create_payment_onion < T : secp256k1:: Signing > (
940
941
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 ,
942
943
keysend_preimage : & Option < PaymentPreimage > , prng_seed : [ u8 ; 32 ]
943
944
) -> Result < ( msgs:: OnionPacket , u64 , u32 ) , APIError > {
944
945
let onion_keys = construct_onion_keys ( & secp_ctx, & path, & session_priv)
945
946
. map_err ( |_| APIError :: InvalidRoute {
946
947
err : "Pubkey along hop was maliciously selected" . to_owned ( )
947
948
} ) ?;
948
949
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
950
951
) ?;
951
952
let onion_packet = construct_onion_packet ( onion_payloads, onion_keys, prng_seed, payment_hash)
952
953
. map_err ( |_| APIError :: InvalidRoute {
0 commit comments