@@ -33,17 +33,17 @@ pub enum ShortChannelIdError {
3333}
3434
3535/// Extracts the block height (most significant 3-bytes) from the `short_channel_id`
36- pub fn block_from_scid ( short_channel_id : & u64 ) -> u32 {
36+ pub fn block_from_scid ( short_channel_id : u64 ) -> u32 {
3737 return ( short_channel_id >> 40 ) as u32 ;
3838}
3939
4040/// Extracts the tx index (bytes [2..4]) from the `short_channel_id`
41- pub fn tx_index_from_scid ( short_channel_id : & u64 ) -> u32 {
41+ pub fn tx_index_from_scid ( short_channel_id : u64 ) -> u32 {
4242 return ( ( short_channel_id >> 16 ) & MAX_SCID_TX_INDEX ) as u32 ;
4343}
4444
4545/// Extracts the vout (bytes [0..2]) from the `short_channel_id`
46- pub fn vout_from_scid ( short_channel_id : & u64 ) -> u16 {
46+ pub fn vout_from_scid ( short_channel_id : u64 ) -> u16 {
4747 return ( ( short_channel_id) & MAX_SCID_VOUT_INDEX ) as u16 ;
4848}
4949
@@ -162,22 +162,22 @@ pub(crate) mod fake_scid {
162162
163163 /// Returns whether the given fake scid falls into the phantom namespace.
164164 pub fn is_valid_phantom ( fake_scid_rand_bytes : & [ u8 ; 32 ] , scid : u64 , chain_hash : & ChainHash ) -> bool {
165- let block_height = scid_utils:: block_from_scid ( & scid) ;
166- let tx_index = scid_utils:: tx_index_from_scid ( & scid) ;
165+ let block_height = scid_utils:: block_from_scid ( scid) ;
166+ let tx_index = scid_utils:: tx_index_from_scid ( scid) ;
167167 let namespace = Namespace :: Phantom ;
168168 let valid_vout = namespace. get_encrypted_vout ( block_height, tx_index, fake_scid_rand_bytes) ;
169169 block_height >= segwit_activation_height ( chain_hash)
170- && valid_vout == scid_utils:: vout_from_scid ( & scid) as u8
170+ && valid_vout == scid_utils:: vout_from_scid ( scid) as u8
171171 }
172172
173173 /// Returns whether the given fake scid falls into the intercept namespace.
174174 pub fn is_valid_intercept ( fake_scid_rand_bytes : & [ u8 ; 32 ] , scid : u64 , chain_hash : & ChainHash ) -> bool {
175- let block_height = scid_utils:: block_from_scid ( & scid) ;
176- let tx_index = scid_utils:: tx_index_from_scid ( & scid) ;
175+ let block_height = scid_utils:: block_from_scid ( scid) ;
176+ let tx_index = scid_utils:: tx_index_from_scid ( scid) ;
177177 let namespace = Namespace :: Intercept ;
178178 let valid_vout = namespace. get_encrypted_vout ( block_height, tx_index, fake_scid_rand_bytes) ;
179179 block_height >= segwit_activation_height ( chain_hash)
180- && valid_vout == scid_utils:: vout_from_scid ( & scid) as u8
180+ && valid_vout == scid_utils:: vout_from_scid ( scid) as u8
181181 }
182182
183183 #[ cfg( test) ]
@@ -248,14 +248,14 @@ pub(crate) mod fake_scid {
248248 let namespace = Namespace :: Phantom ;
249249 let fake_scid = namespace. get_fake_scid ( 500_000 , & mainnet_genesis, & fake_scid_rand_bytes, & keys_manager) ;
250250
251- let fake_height = scid_utils:: block_from_scid ( & fake_scid) ;
251+ let fake_height = scid_utils:: block_from_scid ( fake_scid) ;
252252 assert ! ( fake_height >= MAINNET_SEGWIT_ACTIVATION_HEIGHT ) ;
253253 assert ! ( fake_height <= 500_000 ) ;
254254
255- let fake_tx_index = scid_utils:: tx_index_from_scid ( & fake_scid) ;
255+ let fake_tx_index = scid_utils:: tx_index_from_scid ( fake_scid) ;
256256 assert ! ( fake_tx_index <= MAX_TX_INDEX ) ;
257257
258- let fake_vout = scid_utils:: vout_from_scid ( & fake_scid) ;
258+ let fake_vout = scid_utils:: vout_from_scid ( fake_scid) ;
259259 assert ! ( fake_vout < MAX_NAMESPACES as u16 ) ;
260260 }
261261 }
@@ -267,29 +267,29 @@ mod tests {
267267
268268 #[ test]
269269 fn test_block_from_scid ( ) {
270- assert_eq ! ( block_from_scid( & 0x000000_000000_0000 ) , 0 ) ;
271- assert_eq ! ( block_from_scid( & 0x000001_000000_0000 ) , 1 ) ;
272- assert_eq ! ( block_from_scid( & 0x000001_ffffff_ffff ) , 1 ) ;
273- assert_eq ! ( block_from_scid( & 0x800000_ffffff_ffff ) , 0x800000 ) ;
274- assert_eq ! ( block_from_scid( & 0xffffff_ffffff_ffff ) , 0xffffff ) ;
270+ assert_eq ! ( block_from_scid( 0x000000_000000_0000 ) , 0 ) ;
271+ assert_eq ! ( block_from_scid( 0x000001_000000_0000 ) , 1 ) ;
272+ assert_eq ! ( block_from_scid( 0x000001_ffffff_ffff ) , 1 ) ;
273+ assert_eq ! ( block_from_scid( 0x800000_ffffff_ffff ) , 0x800000 ) ;
274+ assert_eq ! ( block_from_scid( 0xffffff_ffffff_ffff ) , 0xffffff ) ;
275275 }
276276
277277 #[ test]
278278 fn test_tx_index_from_scid ( ) {
279- assert_eq ! ( tx_index_from_scid( & 0x000000_000000_0000 ) , 0 ) ;
280- assert_eq ! ( tx_index_from_scid( & 0x000000_000001_0000 ) , 1 ) ;
281- assert_eq ! ( tx_index_from_scid( & 0xffffff_000001_ffff ) , 1 ) ;
282- assert_eq ! ( tx_index_from_scid( & 0xffffff_800000_ffff ) , 0x800000 ) ;
283- assert_eq ! ( tx_index_from_scid( & 0xffffff_ffffff_ffff ) , 0xffffff ) ;
279+ assert_eq ! ( tx_index_from_scid( 0x000000_000000_0000 ) , 0 ) ;
280+ assert_eq ! ( tx_index_from_scid( 0x000000_000001_0000 ) , 1 ) ;
281+ assert_eq ! ( tx_index_from_scid( 0xffffff_000001_ffff ) , 1 ) ;
282+ assert_eq ! ( tx_index_from_scid( 0xffffff_800000_ffff ) , 0x800000 ) ;
283+ assert_eq ! ( tx_index_from_scid( 0xffffff_ffffff_ffff ) , 0xffffff ) ;
284284 }
285285
286286 #[ test]
287287 fn test_vout_from_scid ( ) {
288- assert_eq ! ( vout_from_scid( & 0x000000_000000_0000 ) , 0 ) ;
289- assert_eq ! ( vout_from_scid( & 0x000000_000000_0001 ) , 1 ) ;
290- assert_eq ! ( vout_from_scid( & 0xffffff_ffffff_0001 ) , 1 ) ;
291- assert_eq ! ( vout_from_scid( & 0xffffff_ffffff_8000 ) , 0x8000 ) ;
292- assert_eq ! ( vout_from_scid( & 0xffffff_ffffff_ffff ) , 0xffff ) ;
288+ assert_eq ! ( vout_from_scid( 0x000000_000000_0000 ) , 0 ) ;
289+ assert_eq ! ( vout_from_scid( 0x000000_000000_0001 ) , 1 ) ;
290+ assert_eq ! ( vout_from_scid( 0xffffff_ffffff_0001 ) , 1 ) ;
291+ assert_eq ! ( vout_from_scid( 0xffffff_ffffff_8000 ) , 0x8000 ) ;
292+ assert_eq ! ( vout_from_scid( 0xffffff_ffffff_ffff ) , 0xffff ) ;
293293 }
294294
295295 #[ test]
0 commit comments