@@ -2336,12 +2336,12 @@ impl Channel {
2336
2336
2337
2337
#[ cfg( test) ]
2338
2338
mod tests {
2339
- use bitcoin:: util:: misc:: hex_bytes;
2340
2339
use bitcoin:: util:: hash:: Sha256dHash ;
2341
2340
use bitcoin:: util:: bip143;
2342
2341
use bitcoin:: network:: serialize:: serialize;
2343
2342
use bitcoin:: blockdata:: script:: Script ;
2344
2343
use bitcoin:: blockdata:: transaction:: Transaction ;
2344
+ use hex;
2345
2345
use ln:: channel:: { Channel , ChannelKeys , HTLCOutput , HTLCState , HTLCOutputInCommitment , TxCreationKeys } ;
2346
2346
use ln:: channel:: MAX_FUNDING_SATOSHIS ;
2347
2347
use ln:: chan_utils;
@@ -2374,19 +2374,19 @@ mod tests {
2374
2374
let secp_ctx = Secp256k1 :: new ( ) ;
2375
2375
2376
2376
let chan_keys = ChannelKeys {
2377
- funding_key : SecretKey :: from_slice ( & secp_ctx, & hex_bytes ( "30ff4956bbdd3222d44cc5e8a1261dab1e07957bdac5ae88fe3261ef321f3749" ) . unwrap ( ) [ ..] ) . unwrap ( ) ,
2378
- payment_base_key : SecretKey :: from_slice ( & secp_ctx, & hex_bytes ( "1111111111111111111111111111111111111111111111111111111111111111" ) . unwrap ( ) [ ..] ) . unwrap ( ) ,
2379
- delayed_payment_base_key : SecretKey :: from_slice ( & secp_ctx, & hex_bytes ( "3333333333333333333333333333333333333333333333333333333333333333" ) . unwrap ( ) [ ..] ) . unwrap ( ) ,
2380
- htlc_base_key : SecretKey :: from_slice ( & secp_ctx, & hex_bytes ( "1111111111111111111111111111111111111111111111111111111111111111" ) . unwrap ( ) [ ..] ) . unwrap ( ) ,
2377
+ funding_key : SecretKey :: from_slice ( & secp_ctx, & hex :: decode ( "30ff4956bbdd3222d44cc5e8a1261dab1e07957bdac5ae88fe3261ef321f3749" ) . unwrap ( ) [ ..] ) . unwrap ( ) ,
2378
+ payment_base_key : SecretKey :: from_slice ( & secp_ctx, & hex :: decode ( "1111111111111111111111111111111111111111111111111111111111111111" ) . unwrap ( ) [ ..] ) . unwrap ( ) ,
2379
+ delayed_payment_base_key : SecretKey :: from_slice ( & secp_ctx, & hex :: decode ( "3333333333333333333333333333333333333333333333333333333333333333" ) . unwrap ( ) [ ..] ) . unwrap ( ) ,
2380
+ htlc_base_key : SecretKey :: from_slice ( & secp_ctx, & hex :: decode ( "1111111111111111111111111111111111111111111111111111111111111111" ) . unwrap ( ) [ ..] ) . unwrap ( ) ,
2381
2381
2382
2382
// These aren't set in the test vectors:
2383
- revocation_base_key : SecretKey :: from_slice ( & secp_ctx, & hex_bytes ( "0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" ) . unwrap ( ) [ ..] ) . unwrap ( ) ,
2384
- channel_close_key : SecretKey :: from_slice ( & secp_ctx, & hex_bytes ( "0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" ) . unwrap ( ) [ ..] ) . unwrap ( ) ,
2385
- channel_monitor_claim_key : SecretKey :: from_slice ( & secp_ctx, & hex_bytes ( "0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" ) . unwrap ( ) [ ..] ) . unwrap ( ) ,
2383
+ revocation_base_key : SecretKey :: from_slice ( & secp_ctx, & hex :: decode ( "0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" ) . unwrap ( ) [ ..] ) . unwrap ( ) ,
2384
+ channel_close_key : SecretKey :: from_slice ( & secp_ctx, & hex :: decode ( "0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" ) . unwrap ( ) [ ..] ) . unwrap ( ) ,
2385
+ channel_monitor_claim_key : SecretKey :: from_slice ( & secp_ctx, & hex :: decode ( "0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" ) . unwrap ( ) [ ..] ) . unwrap ( ) ,
2386
2386
commitment_seed : [ 0xff , 0xff , 0xff , 0xff , 0xff , 0xff , 0xff , 0xff , 0xff , 0xff , 0xff , 0xff , 0xff , 0xff , 0xff , 0xff , 0xff , 0xff , 0xff , 0xff , 0xff , 0xff , 0xff , 0xff , 0xff , 0xff , 0xff , 0xff , 0xff , 0xff , 0xff , 0xff ] ,
2387
2387
} ;
2388
2388
assert_eq ! ( PublicKey :: from_secret_key( & secp_ctx, & chan_keys. funding_key) . unwrap( ) . serialize( ) [ ..] ,
2389
- hex_bytes ( "023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb" ) . unwrap( ) [ ..] ) ;
2389
+ hex :: decode ( "023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb" ) . unwrap( ) [ ..] ) ;
2390
2390
2391
2391
let mut chan = Channel :: new_outbound ( & feeest, chan_keys, PublicKey :: new ( ) , 10000000 , false , 42 ) ; // Nothing uses their network key in this test
2392
2392
chan. their_to_self_delay = 144 ;
@@ -2395,25 +2395,25 @@ mod tests {
2395
2395
let funding_info = OutPoint :: new ( Sha256dHash :: from_hex ( "8984484a580b825b9972d7adb15050b3ab624ccd731946b3eeddb92f4e7ef6be" ) . unwrap ( ) , 0 ) ;
2396
2396
chan. channel_monitor . set_funding_info ( ( funding_info, Script :: new ( ) ) ) ;
2397
2397
2398
- chan. their_payment_basepoint = PublicKey :: from_secret_key ( & secp_ctx, & SecretKey :: from_slice ( & secp_ctx, & hex_bytes ( "4444444444444444444444444444444444444444444444444444444444444444" ) . unwrap ( ) [ ..] ) . unwrap ( ) ) . unwrap ( ) ;
2398
+ chan. their_payment_basepoint = PublicKey :: from_secret_key ( & secp_ctx, & SecretKey :: from_slice ( & secp_ctx, & hex :: decode ( "4444444444444444444444444444444444444444444444444444444444444444" ) . unwrap ( ) [ ..] ) . unwrap ( ) ) . unwrap ( ) ;
2399
2399
assert_eq ! ( chan. their_payment_basepoint. serialize( ) [ ..] ,
2400
- hex_bytes ( "032c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991" ) . unwrap( ) [ ..] ) ;
2400
+ hex :: decode ( "032c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991" ) . unwrap( ) [ ..] ) ;
2401
2401
2402
- chan. their_funding_pubkey = PublicKey :: from_secret_key ( & secp_ctx, & SecretKey :: from_slice ( & secp_ctx, & hex_bytes ( "1552dfba4f6cf29a62a0af13c8d6981d36d0ef8d61ba10fb0fe90da7634d7e13" ) . unwrap ( ) [ ..] ) . unwrap ( ) ) . unwrap ( ) ;
2402
+ chan. their_funding_pubkey = PublicKey :: from_secret_key ( & secp_ctx, & SecretKey :: from_slice ( & secp_ctx, & hex :: decode ( "1552dfba4f6cf29a62a0af13c8d6981d36d0ef8d61ba10fb0fe90da7634d7e13" ) . unwrap ( ) [ ..] ) . unwrap ( ) ) . unwrap ( ) ;
2403
2403
assert_eq ! ( chan. their_funding_pubkey. serialize( ) [ ..] ,
2404
- hex_bytes ( "030e9f7b623d2ccc7c9bd44d66d5ce21ce504c0acf6385a132cec6d3c39fa711c1" ) . unwrap( ) [ ..] ) ;
2404
+ hex :: decode ( "030e9f7b623d2ccc7c9bd44d66d5ce21ce504c0acf6385a132cec6d3c39fa711c1" ) . unwrap( ) [ ..] ) ;
2405
2405
2406
- chan. their_htlc_basepoint = PublicKey :: from_secret_key ( & secp_ctx, & SecretKey :: from_slice ( & secp_ctx, & hex_bytes ( "4444444444444444444444444444444444444444444444444444444444444444" ) . unwrap ( ) [ ..] ) . unwrap ( ) ) . unwrap ( ) ;
2406
+ chan. their_htlc_basepoint = PublicKey :: from_secret_key ( & secp_ctx, & SecretKey :: from_slice ( & secp_ctx, & hex :: decode ( "4444444444444444444444444444444444444444444444444444444444444444" ) . unwrap ( ) [ ..] ) . unwrap ( ) ) . unwrap ( ) ;
2407
2407
assert_eq ! ( chan. their_htlc_basepoint. serialize( ) [ ..] ,
2408
- hex_bytes ( "032c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991" ) . unwrap( ) [ ..] ) ;
2408
+ hex :: decode ( "032c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991" ) . unwrap( ) [ ..] ) ;
2409
2409
2410
- chan. their_revocation_basepoint = PublicKey :: from_slice ( & secp_ctx, & hex_bytes ( "02466d7fcae563e5cb09a0d1870bb580344804617879a14949cf22285f1bae3f27" ) . unwrap ( ) [ ..] ) . unwrap ( ) ;
2410
+ chan. their_revocation_basepoint = PublicKey :: from_slice ( & secp_ctx, & hex :: decode ( "02466d7fcae563e5cb09a0d1870bb580344804617879a14949cf22285f1bae3f27" ) . unwrap ( ) [ ..] ) . unwrap ( ) ;
2411
2411
2412
2412
// We can't just use build_local_transaction_keys here as the per_commitment_secret is not
2413
2413
// derived from a commitment_seed, so instead we copy it here and call
2414
2414
// build_commitment_transaction.
2415
2415
let delayed_payment_base = PublicKey :: from_secret_key ( & secp_ctx, & chan. local_keys . delayed_payment_base_key ) . unwrap ( ) ;
2416
- let per_commitment_secret = SecretKey :: from_slice ( & secp_ctx, & hex_bytes ( "1f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100" ) . unwrap ( ) [ ..] ) . unwrap ( ) ;
2416
+ let per_commitment_secret = SecretKey :: from_slice ( & secp_ctx, & hex :: decode ( "1f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100" ) . unwrap ( ) [ ..] ) . unwrap ( ) ;
2417
2417
let per_commitment_point = PublicKey :: from_secret_key ( & secp_ctx, & per_commitment_secret) . unwrap ( ) ;
2418
2418
let htlc_basepoint = PublicKey :: from_secret_key ( & secp_ctx, & chan. local_keys . htlc_base_key ) . unwrap ( ) ;
2419
2419
let keys = TxCreationKeys :: new ( & secp_ctx, & per_commitment_point, & delayed_payment_base, & htlc_basepoint, & chan. their_revocation_basepoint , & chan. their_payment_basepoint , & chan. their_htlc_basepoint ) . unwrap ( ) ;
@@ -2423,20 +2423,20 @@ mod tests {
2423
2423
macro_rules! test_commitment {
2424
2424
( $their_sig_hex: expr, $our_sig_hex: expr, $tx_hex: expr) => {
2425
2425
unsigned_tx = chan. build_commitment_transaction( 0xffffffffffff - 42 , & keys, true , false ) ;
2426
- let their_signature = Signature :: from_der( & secp_ctx, & hex_bytes ( $their_sig_hex) . unwrap( ) [ ..] ) . unwrap( ) ;
2426
+ let their_signature = Signature :: from_der( & secp_ctx, & hex :: decode ( $their_sig_hex) . unwrap( ) [ ..] ) . unwrap( ) ;
2427
2427
let sighash = Message :: from_slice( & bip143:: SighashComponents :: new( & unsigned_tx. 0 ) . sighash_all( & unsigned_tx. 0 . input[ 0 ] , & chan. get_funding_redeemscript( ) , chan. channel_value_satoshis) [ ..] ) . unwrap( ) ;
2428
2428
secp_ctx. verify( & sighash, & their_signature, & chan. their_funding_pubkey) . unwrap( ) ;
2429
2429
2430
2430
chan. sign_commitment_transaction( & mut unsigned_tx. 0 , & their_signature) ;
2431
2431
2432
2432
assert_eq!( serialize( & unsigned_tx. 0 ) . unwrap( ) [ ..] ,
2433
- hex_bytes ( $tx_hex) . unwrap( ) [ ..] ) ;
2433
+ hex :: decode ( $tx_hex) . unwrap( ) [ ..] ) ;
2434
2434
} ;
2435
2435
}
2436
2436
2437
2437
macro_rules! test_htlc_output {
2438
2438
( $htlc_idx: expr, $their_sig_hex: expr, $our_sig_hex: expr, $tx_hex: expr ) => {
2439
- let remote_signature = Signature :: from_der( & secp_ctx, & hex_bytes ( $their_sig_hex) . unwrap( ) [ ..] ) . unwrap( ) ;
2439
+ let remote_signature = Signature :: from_der( & secp_ctx, & hex :: decode ( $their_sig_hex) . unwrap( ) [ ..] ) . unwrap( ) ;
2440
2440
2441
2441
let ref htlc = unsigned_tx. 1 [ $htlc_idx] ;
2442
2442
let mut htlc_tx = chan. build_htlc_transaction( & unsigned_tx. 0 . txid( ) , & htlc, true , & keys) ;
@@ -2463,7 +2463,7 @@ mod tests {
2463
2463
2464
2464
chan. sign_htlc_transaction( & mut htlc_tx, & remote_signature, & preimage, & htlc, & keys) . unwrap( ) ;
2465
2465
assert_eq!( serialize( & htlc_tx) . unwrap( ) [ ..] ,
2466
- hex_bytes ( $tx_hex) . unwrap( ) [ ..] ) ;
2466
+ hex :: decode ( $tx_hex) . unwrap( ) [ ..] ) ;
2467
2467
} ;
2468
2468
}
2469
2469
@@ -2489,7 +2489,7 @@ mod tests {
2489
2489
pending_forward_state : None ,
2490
2490
} ;
2491
2491
let mut sha = Sha256 :: new ( ) ;
2492
- sha. input ( & hex_bytes ( "0000000000000000000000000000000000000000000000000000000000000000" ) . unwrap ( ) ) ;
2492
+ sha. input ( & hex :: decode ( "0000000000000000000000000000000000000000000000000000000000000000" ) . unwrap ( ) ) ;
2493
2493
sha. result ( & mut out. payment_hash ) ;
2494
2494
out
2495
2495
} ) ;
@@ -2506,7 +2506,7 @@ mod tests {
2506
2506
pending_forward_state : None ,
2507
2507
} ;
2508
2508
let mut sha = Sha256 :: new ( ) ;
2509
- sha. input ( & hex_bytes ( "0101010101010101010101010101010101010101010101010101010101010101" ) . unwrap ( ) ) ;
2509
+ sha. input ( & hex :: decode ( "0101010101010101010101010101010101010101010101010101010101010101" ) . unwrap ( ) ) ;
2510
2510
sha. result ( & mut out. payment_hash ) ;
2511
2511
out
2512
2512
} ) ;
@@ -2523,7 +2523,7 @@ mod tests {
2523
2523
pending_forward_state : None ,
2524
2524
} ;
2525
2525
let mut sha = Sha256 :: new ( ) ;
2526
- sha. input ( & hex_bytes ( "0202020202020202020202020202020202020202020202020202020202020202" ) . unwrap ( ) ) ;
2526
+ sha. input ( & hex :: decode ( "0202020202020202020202020202020202020202020202020202020202020202" ) . unwrap ( ) ) ;
2527
2527
sha. result ( & mut out. payment_hash ) ;
2528
2528
out
2529
2529
} ) ;
@@ -2540,7 +2540,7 @@ mod tests {
2540
2540
pending_forward_state : None ,
2541
2541
} ;
2542
2542
let mut sha = Sha256 :: new ( ) ;
2543
- sha. input ( & hex_bytes ( "0303030303030303030303030303030303030303030303030303030303030303" ) . unwrap ( ) ) ;
2543
+ sha. input ( & hex :: decode ( "0303030303030303030303030303030303030303030303030303030303030303" ) . unwrap ( ) ) ;
2544
2544
sha. result ( & mut out. payment_hash ) ;
2545
2545
out
2546
2546
} ) ;
@@ -2557,7 +2557,7 @@ mod tests {
2557
2557
pending_forward_state : None ,
2558
2558
} ;
2559
2559
let mut sha = Sha256 :: new ( ) ;
2560
- sha. input ( & hex_bytes ( "0404040404040404040404040404040404040404040404040404040404040404" ) . unwrap ( ) ) ;
2560
+ sha. input ( & hex :: decode ( "0404040404040404040404040404040404040404040404040404040404040404" ) . unwrap ( ) ) ;
2561
2561
sha. result ( & mut out. payment_hash ) ;
2562
2562
out
2563
2563
} ) ;
@@ -2886,49 +2886,49 @@ mod tests {
2886
2886
// Test vectors from BOLT 3 Appendix D:
2887
2887
2888
2888
let mut seed = [ 0 ; 32 ] ;
2889
- seed[ 0 ..32 ] . clone_from_slice ( & hex_bytes ( "0000000000000000000000000000000000000000000000000000000000000000" ) . unwrap ( ) ) ;
2889
+ seed[ 0 ..32 ] . clone_from_slice ( & hex :: decode ( "0000000000000000000000000000000000000000000000000000000000000000" ) . unwrap ( ) ) ;
2890
2890
assert_eq ! ( chan_utils:: build_commitment_secret( seed, 281474976710655 ) ,
2891
- hex_bytes ( "02a40c85b6f28da08dfdbe0926c53fab2de6d28c10301f8f7c4073d5e42e3148" ) . unwrap( ) [ ..] ) ;
2891
+ hex :: decode ( "02a40c85b6f28da08dfdbe0926c53fab2de6d28c10301f8f7c4073d5e42e3148" ) . unwrap( ) [ ..] ) ;
2892
2892
2893
- seed[ 0 ..32 ] . clone_from_slice ( & hex_bytes ( "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" ) . unwrap ( ) ) ;
2893
+ seed[ 0 ..32 ] . clone_from_slice ( & hex :: decode ( "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" ) . unwrap ( ) ) ;
2894
2894
assert_eq ! ( chan_utils:: build_commitment_secret( seed, 281474976710655 ) ,
2895
- hex_bytes ( "7cc854b54e3e0dcdb010d7a3fee464a9687be6e8db3be6854c475621e007a5dc" ) . unwrap( ) [ ..] ) ;
2895
+ hex :: decode ( "7cc854b54e3e0dcdb010d7a3fee464a9687be6e8db3be6854c475621e007a5dc" ) . unwrap( ) [ ..] ) ;
2896
2896
2897
2897
assert_eq ! ( chan_utils:: build_commitment_secret( seed, 0xaaaaaaaaaaa ) ,
2898
- hex_bytes ( "56f4008fb007ca9acf0e15b054d5c9fd12ee06cea347914ddbaed70d1c13a528" ) . unwrap( ) [ ..] ) ;
2898
+ hex :: decode ( "56f4008fb007ca9acf0e15b054d5c9fd12ee06cea347914ddbaed70d1c13a528" ) . unwrap( ) [ ..] ) ;
2899
2899
2900
2900
assert_eq ! ( chan_utils:: build_commitment_secret( seed, 0x555555555555 ) ,
2901
- hex_bytes ( "9015daaeb06dba4ccc05b91b2f73bd54405f2be9f217fbacd3c5ac2e62327d31" ) . unwrap( ) [ ..] ) ;
2901
+ hex :: decode ( "9015daaeb06dba4ccc05b91b2f73bd54405f2be9f217fbacd3c5ac2e62327d31" ) . unwrap( ) [ ..] ) ;
2902
2902
2903
- seed[ 0 ..32 ] . clone_from_slice ( & hex_bytes ( "0101010101010101010101010101010101010101010101010101010101010101" ) . unwrap ( ) ) ;
2903
+ seed[ 0 ..32 ] . clone_from_slice ( & hex :: decode ( "0101010101010101010101010101010101010101010101010101010101010101" ) . unwrap ( ) ) ;
2904
2904
assert_eq ! ( chan_utils:: build_commitment_secret( seed, 1 ) ,
2905
- hex_bytes ( "915c75942a26bb3a433a8ce2cb0427c29ec6c1775cfc78328b57f6ba7bfeaa9c" ) . unwrap( ) [ ..] ) ;
2905
+ hex :: decode ( "915c75942a26bb3a433a8ce2cb0427c29ec6c1775cfc78328b57f6ba7bfeaa9c" ) . unwrap( ) [ ..] ) ;
2906
2906
}
2907
2907
2908
2908
#[ test]
2909
2909
fn test_key_derivation ( ) {
2910
2910
// Test vectors from BOLT 3 Appendix E:
2911
2911
let secp_ctx = Secp256k1 :: new ( ) ;
2912
2912
2913
- let base_secret = SecretKey :: from_slice ( & secp_ctx, & hex_bytes ( "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f" ) . unwrap ( ) [ ..] ) . unwrap ( ) ;
2914
- let per_commitment_secret = SecretKey :: from_slice ( & secp_ctx, & hex_bytes ( "1f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100" ) . unwrap ( ) [ ..] ) . unwrap ( ) ;
2913
+ let base_secret = SecretKey :: from_slice ( & secp_ctx, & hex :: decode ( "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f" ) . unwrap ( ) [ ..] ) . unwrap ( ) ;
2914
+ let per_commitment_secret = SecretKey :: from_slice ( & secp_ctx, & hex :: decode ( "1f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100" ) . unwrap ( ) [ ..] ) . unwrap ( ) ;
2915
2915
2916
2916
let base_point = PublicKey :: from_secret_key ( & secp_ctx, & base_secret) . unwrap ( ) ;
2917
- assert_eq ! ( base_point. serialize( ) [ ..] , hex_bytes ( "036d6caac248af96f6afa7f904f550253a0f3ef3f5aa2fe6838a95b216691468e2" ) . unwrap( ) [ ..] ) ;
2917
+ assert_eq ! ( base_point. serialize( ) [ ..] , hex :: decode ( "036d6caac248af96f6afa7f904f550253a0f3ef3f5aa2fe6838a95b216691468e2" ) . unwrap( ) [ ..] ) ;
2918
2918
2919
2919
let per_commitment_point = PublicKey :: from_secret_key ( & secp_ctx, & per_commitment_secret) . unwrap ( ) ;
2920
- assert_eq ! ( per_commitment_point. serialize( ) [ ..] , hex_bytes ( "025f7117a78150fe2ef97db7cfc83bd57b2e2c0d0dd25eaf467a4a1c2a45ce1486" ) . unwrap( ) [ ..] ) ;
2920
+ assert_eq ! ( per_commitment_point. serialize( ) [ ..] , hex :: decode ( "025f7117a78150fe2ef97db7cfc83bd57b2e2c0d0dd25eaf467a4a1c2a45ce1486" ) . unwrap( ) [ ..] ) ;
2921
2921
2922
2922
assert_eq ! ( chan_utils:: derive_public_key( & secp_ctx, & per_commitment_point, & base_point) . unwrap( ) . serialize( ) [ ..] ,
2923
- hex_bytes ( "0235f2dbfaa89b57ec7b055afe29849ef7ddfeb1cefdb9ebdc43f5494984db29e5" ) . unwrap( ) [ ..] ) ;
2923
+ hex :: decode ( "0235f2dbfaa89b57ec7b055afe29849ef7ddfeb1cefdb9ebdc43f5494984db29e5" ) . unwrap( ) [ ..] ) ;
2924
2924
2925
2925
assert_eq ! ( chan_utils:: derive_private_key( & secp_ctx, & per_commitment_point, & base_secret) . unwrap( ) ,
2926
- SecretKey :: from_slice( & secp_ctx, & hex_bytes ( "cbced912d3b21bf196a766651e436aff192362621ce317704ea2f75d87e7be0f" ) . unwrap( ) [ ..] ) . unwrap( ) ) ;
2926
+ SecretKey :: from_slice( & secp_ctx, & hex :: decode ( "cbced912d3b21bf196a766651e436aff192362621ce317704ea2f75d87e7be0f" ) . unwrap( ) [ ..] ) . unwrap( ) ) ;
2927
2927
2928
2928
assert_eq ! ( chan_utils:: derive_public_revocation_key( & secp_ctx, & per_commitment_point, & base_point) . unwrap( ) . serialize( ) [ ..] ,
2929
- hex_bytes ( "02916e326636d19c33f13e8c0c3a03dd157f332f3e99c317c141dd865eb01f8ff0" ) . unwrap( ) [ ..] ) ;
2929
+ hex :: decode ( "02916e326636d19c33f13e8c0c3a03dd157f332f3e99c317c141dd865eb01f8ff0" ) . unwrap( ) [ ..] ) ;
2930
2930
2931
2931
assert_eq ! ( chan_utils:: derive_private_revocation_key( & secp_ctx, & per_commitment_secret, & base_secret) . unwrap( ) ,
2932
- SecretKey :: from_slice( & secp_ctx, & hex_bytes ( "d09ffff62ddb2297ab000cc85bcb4283fdeb6aa052affbc9dddcf33b61078110" ) . unwrap( ) [ ..] ) . unwrap( ) ) ;
2932
+ SecretKey :: from_slice( & secp_ctx, & hex :: decode ( "d09ffff62ddb2297ab000cc85bcb4283fdeb6aa052affbc9dddcf33b61078110" ) . unwrap( ) [ ..] ) . unwrap( ) ) ;
2933
2933
}
2934
2934
}
0 commit comments