@@ -149,11 +149,11 @@ pub(super) fn construct_onion_keys<T: secp256k1::Signing>(secp_ctx: &Secp256k1<T
149
149
}
150
150
151
151
/// returns the hop data, as well as the first-hop value_msat and CLTV value we should send.
152
- pub ( super ) fn build_onion_payloads ( path : & Path , total_msat : u64 , mut recipient_onion : RecipientOnionFields , starting_htlc_offset : u32 , keysend_preimage : & Option < PaymentPreimage > ) -> Result < ( Vec < msgs:: OutboundPayload > , u64 , u32 ) , APIError > {
152
+ pub ( super ) fn build_onion_payloads ( path : & Path , total_msat : u64 , mut recipient_onion : RecipientOnionFields , starting_htlc_offset : u32 , keysend_preimage : & Option < PaymentPreimage > ) -> Result < ( Vec < msgs:: OutboundOnionPayload > , u64 , u32 ) , APIError > {
153
153
let mut cur_value_msat = 0u64 ;
154
154
let mut cur_cltv = starting_htlc_offset;
155
155
let mut last_short_channel_id = 0 ;
156
- let mut res: Vec < msgs:: OutboundPayload > = Vec :: with_capacity ( path. hops . len ( ) ) ;
156
+ let mut res: Vec < msgs:: OutboundOnionPayload > = Vec :: with_capacity ( path. hops . len ( ) ) ;
157
157
158
158
for ( idx, hop) in path. hops . iter ( ) . rev ( ) . enumerate ( ) {
159
159
// First hop gets special values so that it can check, on receipt, that everything is
@@ -162,7 +162,7 @@ pub(super) fn build_onion_payloads(path: &Path, total_msat: u64, mut recipient_o
162
162
let value_msat = if cur_value_msat == 0 { hop. fee_msat } else { cur_value_msat } ;
163
163
let cltv = if cur_cltv == starting_htlc_offset { hop. cltv_expiry_delta + starting_htlc_offset } else { cur_cltv } ;
164
164
res. insert ( 0 , if idx == 0 {
165
- msgs:: OutboundPayload :: Receive {
165
+ msgs:: OutboundOnionPayload :: Receive {
166
166
payment_data : if let Some ( secret) = recipient_onion. payment_secret . take ( ) {
167
167
Some ( msgs:: FinalOnionHopData {
168
168
payment_secret : secret,
@@ -175,7 +175,7 @@ pub(super) fn build_onion_payloads(path: &Path, total_msat: u64, mut recipient_o
175
175
outgoing_cltv_value : cltv,
176
176
}
177
177
} else {
178
- msgs:: OutboundPayload :: Forward {
178
+ msgs:: OutboundOnionPayload :: Forward {
179
179
short_channel_id : last_short_channel_id,
180
180
amt_to_forward : value_msat,
181
181
outgoing_cltv_value : cltv,
@@ -209,7 +209,7 @@ fn shift_slice_right(arr: &mut [u8], amt: usize) {
209
209
}
210
210
211
211
pub ( super ) fn construct_onion_packet (
212
- payloads : Vec < msgs:: OutboundPayload > , onion_keys : Vec < OnionKeys > , prng_seed : [ u8 ; 32 ] ,
212
+ payloads : Vec < msgs:: OutboundOnionPayload > , onion_keys : Vec < OnionKeys > , prng_seed : [ u8 ; 32 ] ,
213
213
associated_data : & PaymentHash
214
214
) -> Result < msgs:: OnionPacket , ( ) > {
215
215
let mut packet_data = [ 0 ; ONION_DATA_LEN ] ;
@@ -991,7 +991,7 @@ mod tests {
991
991
// with raw hex instead of our in-memory enums, as the payloads contains custom types, and
992
992
// we have no way of representing that with our enums.
993
993
let payloads = vec ! (
994
- RawOnionHopData :: new( msgs:: OutboundPayload :: Forward {
994
+ RawOnionHopData :: new( msgs:: OutboundOnionPayload :: Forward {
995
995
short_channel_id: 1 ,
996
996
amt_to_forward: 15000 ,
997
997
outgoing_cltv_value: 1500 ,
@@ -1014,12 +1014,12 @@ mod tests {
1014
1014
RawOnionHopData {
1015
1015
data: hex:: decode( "52020236b00402057806080000000000000002fd02013c0102030405060708090a0b0c0d0e0f0102030405060708090a0b0c0d0e0f0102030405060708090a0b0c0d0e0f0102030405060708090a0b0c0d0e0f" ) . unwrap( ) ,
1016
1016
} ,
1017
- RawOnionHopData :: new( msgs:: OutboundPayload :: Forward {
1017
+ RawOnionHopData :: new( msgs:: OutboundOnionPayload :: Forward {
1018
1018
short_channel_id: 3 ,
1019
1019
amt_to_forward: 12500 ,
1020
1020
outgoing_cltv_value: 1250 ,
1021
1021
} ) ,
1022
- RawOnionHopData :: new( msgs:: OutboundPayload :: Forward {
1022
+ RawOnionHopData :: new( msgs:: OutboundOnionPayload :: Forward {
1023
1023
short_channel_id: 4 ,
1024
1024
amt_to_forward: 10000 ,
1025
1025
outgoing_cltv_value: 1000 ,
@@ -1098,7 +1098,7 @@ mod tests {
1098
1098
data : Vec < u8 >
1099
1099
}
1100
1100
impl RawOnionHopData {
1101
- fn new ( orig : msgs:: OutboundPayload ) -> Self {
1101
+ fn new ( orig : msgs:: OutboundOnionPayload ) -> Self {
1102
1102
Self { data : orig. encode ( ) }
1103
1103
}
1104
1104
}
0 commit comments