@@ -42,7 +42,7 @@ use io_extras::read_to_end;
42
42
43
43
use util:: events:: MessageSendEventsProvider ;
44
44
use util:: logger;
45
- use util:: ser:: { BigSize , LengthReadable , Readable , ReadableArgs , Writeable , Writer , FixedLengthReader , HighZeroBytesDroppedVarInt , Hostname } ;
45
+ use util:: ser:: { BigSize , LengthReadable , Readable , ReadableArgs , Writeable , Writer , FixedLengthReader , HighZeroBytesDroppedBigSize , Hostname } ;
46
46
47
47
use ln:: { PaymentPreimage , PaymentHash , PaymentSecret } ;
48
48
@@ -1375,14 +1375,14 @@ impl Writeable for OnionMessage {
1375
1375
impl Writeable for FinalOnionHopData {
1376
1376
fn write < W : Writer > ( & self , w : & mut W ) -> Result < ( ) , io:: Error > {
1377
1377
self . payment_secret . 0 . write ( w) ?;
1378
- HighZeroBytesDroppedVarInt ( self . total_msat ) . write ( w)
1378
+ HighZeroBytesDroppedBigSize ( self . total_msat ) . write ( w)
1379
1379
}
1380
1380
}
1381
1381
1382
1382
impl Readable for FinalOnionHopData {
1383
1383
fn read < R : Read > ( r : & mut R ) -> Result < Self , DecodeError > {
1384
1384
let secret: [ u8 ; 32 ] = Readable :: read ( r) ?;
1385
- let amt: HighZeroBytesDroppedVarInt < u64 > = Readable :: read ( r) ?;
1385
+ let amt: HighZeroBytesDroppedBigSize < u64 > = Readable :: read ( r) ?;
1386
1386
Ok ( Self { payment_secret : PaymentSecret ( secret) , total_msat : amt. 0 } )
1387
1387
}
1388
1388
}
@@ -1399,15 +1399,15 @@ impl Writeable for OnionHopData {
1399
1399
} ,
1400
1400
OnionHopDataFormat :: NonFinalNode { short_channel_id } => {
1401
1401
encode_varint_length_prefixed_tlv ! ( w, {
1402
- ( 2 , HighZeroBytesDroppedVarInt ( self . amt_to_forward) , required) ,
1403
- ( 4 , HighZeroBytesDroppedVarInt ( self . outgoing_cltv_value) , required) ,
1402
+ ( 2 , HighZeroBytesDroppedBigSize ( self . amt_to_forward) , required) ,
1403
+ ( 4 , HighZeroBytesDroppedBigSize ( self . outgoing_cltv_value) , required) ,
1404
1404
( 6 , short_channel_id, required)
1405
1405
} ) ;
1406
1406
} ,
1407
1407
OnionHopDataFormat :: FinalNode { ref payment_data, ref keysend_preimage } => {
1408
1408
encode_varint_length_prefixed_tlv ! ( w, {
1409
- ( 2 , HighZeroBytesDroppedVarInt ( self . amt_to_forward) , required) ,
1410
- ( 4 , HighZeroBytesDroppedVarInt ( self . outgoing_cltv_value) , required) ,
1409
+ ( 2 , HighZeroBytesDroppedBigSize ( self . amt_to_forward) , required) ,
1410
+ ( 4 , HighZeroBytesDroppedBigSize ( self . outgoing_cltv_value) , required) ,
1411
1411
( 8 , payment_data, option) ,
1412
1412
( 5482373484 , keysend_preimage, option)
1413
1413
} ) ;
@@ -1423,8 +1423,8 @@ impl Readable for OnionHopData {
1423
1423
const LEGACY_ONION_HOP_FLAG : u64 = 0 ;
1424
1424
let ( format, amt, cltv_value) = if b. 0 != LEGACY_ONION_HOP_FLAG {
1425
1425
let mut rd = FixedLengthReader :: new ( r, b. 0 ) ;
1426
- let mut amt = HighZeroBytesDroppedVarInt ( 0u64 ) ;
1427
- let mut cltv_value = HighZeroBytesDroppedVarInt ( 0u32 ) ;
1426
+ let mut amt = HighZeroBytesDroppedBigSize ( 0u64 ) ;
1427
+ let mut cltv_value = HighZeroBytesDroppedBigSize ( 0u32 ) ;
1428
1428
let mut short_id: Option < u64 > = None ;
1429
1429
let mut payment_data: Option < FinalOnionHopData > = None ;
1430
1430
let mut keysend_preimage: Option < PaymentPreimage > = None ;
@@ -2835,7 +2835,7 @@ mod tests {
2835
2835
}
2836
2836
// see above test, needs to be a separate method for use of the serialization macros.
2837
2837
fn encode_big_payload ( ) -> Result < Vec < u8 > , std:: io:: Error > {
2838
- use util:: ser:: HighZeroBytesDroppedVarInt ;
2838
+ use util:: ser:: HighZeroBytesDroppedBigSize ;
2839
2839
let payload = msgs:: OnionHopData {
2840
2840
format : OnionHopDataFormat :: NonFinalNode {
2841
2841
short_channel_id : 0xdeadbeef1bad1dea ,
@@ -2848,8 +2848,8 @@ mod tests {
2848
2848
if let OnionHopDataFormat :: NonFinalNode { short_channel_id } = payload. format {
2849
2849
encode_varint_length_prefixed_tlv ! ( & mut encoded_payload, {
2850
2850
( 1 , test_bytes, vec_type) ,
2851
- ( 2 , HighZeroBytesDroppedVarInt ( payload. amt_to_forward) , required) ,
2852
- ( 4 , HighZeroBytesDroppedVarInt ( payload. outgoing_cltv_value) , required) ,
2851
+ ( 2 , HighZeroBytesDroppedBigSize ( payload. amt_to_forward) , required) ,
2852
+ ( 4 , HighZeroBytesDroppedBigSize ( payload. outgoing_cltv_value) , required) ,
2853
2853
( 6 , short_channel_id, required)
2854
2854
} ) ;
2855
2855
}
0 commit comments