Skip to content

Commit e6aaf7c

Browse files
committed
Pull secp256k1 contexts from per-peer to per-PeerManager
Instead of including a `Secp256k1` context per `PeerChannelEncryptor`, which is relatively expensive memory-wise and nontrivial CPU-wise to construct, we should keep one for all peers and simply reuse it. This is relatively trivial so we do so in this commit. Since its trivial to do so, we also take this opportunity to randomize the new PeerManager context.
1 parent b5a6307 commit e6aaf7c

File tree

3 files changed

+61
-47
lines changed

3 files changed

+61
-47
lines changed

fuzz/src/peer_crypt.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
use lightning::ln::peer_channel_encryptor::PeerChannelEncryptor;
1111

12-
use bitcoin::secp256k1::{PublicKey,SecretKey};
12+
use bitcoin::secp256k1::{Secp256k1, PublicKey, SecretKey};
1313

1414
use utils::test_logger;
1515

@@ -35,6 +35,8 @@ pub fn do_test(data: &[u8]) {
3535
}
3636
}
3737

38+
let secp_ctx = Secp256k1::signing_only();
39+
3840
let our_network_key = match SecretKey::from_slice(get_slice!(32)) {
3941
Ok(key) => key,
4042
Err(_) => return,
@@ -50,16 +52,16 @@ pub fn do_test(data: &[u8]) {
5052
Err(_) => return,
5153
};
5254
let mut crypter = PeerChannelEncryptor::new_outbound(their_pubkey, ephemeral_key);
53-
crypter.get_act_one();
54-
match crypter.process_act_two(get_slice!(50), &our_network_key) {
55+
crypter.get_act_one(&secp_ctx);
56+
match crypter.process_act_two(get_slice!(50), &our_network_key, &secp_ctx) {
5557
Ok(_) => {},
5658
Err(_) => return,
5759
}
5860
assert!(crypter.is_ready_for_encryption());
5961
crypter
6062
} else {
61-
let mut crypter = PeerChannelEncryptor::new_inbound(&our_network_key);
62-
match crypter.process_act_one_with_keys(get_slice!(50), &our_network_key, ephemeral_key) {
63+
let mut crypter = PeerChannelEncryptor::new_inbound(&our_network_key, &secp_ctx);
64+
match crypter.process_act_one_with_keys(get_slice!(50), &our_network_key, ephemeral_key, &secp_ctx) {
6365
Ok(_) => {},
6466
Err(_) => return,
6567
}

lightning/src/ln/peer_channel_encryptor.rs

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -80,24 +80,20 @@ enum NoiseState {
8080
}
8181

8282
pub struct PeerChannelEncryptor {
83-
secp_ctx: Secp256k1<secp256k1::SignOnly>,
8483
their_node_id: Option<PublicKey>, // filled in for outbound, or inbound after noise_state is Finished
8584

8685
noise_state: NoiseState,
8786
}
8887

8988
impl PeerChannelEncryptor {
9089
pub fn new_outbound(their_node_id: PublicKey, ephemeral_key: SecretKey) -> PeerChannelEncryptor {
91-
let secp_ctx = Secp256k1::signing_only();
92-
9390
let mut sha = Sha256::engine();
9491
sha.input(&NOISE_H);
9592
sha.input(&their_node_id.serialize()[..]);
9693
let h = Sha256::from_engine(sha).into_inner();
9794

9895
PeerChannelEncryptor {
9996
their_node_id: Some(their_node_id),
100-
secp_ctx,
10197
noise_state: NoiseState::InProgress {
10298
state: NoiseStep::PreActOne,
10399
directional_state: DirectionalNoiseState::Outbound {
@@ -111,9 +107,7 @@ impl PeerChannelEncryptor {
111107
}
112108
}
113109

114-
pub fn new_inbound(our_node_secret: &SecretKey) -> PeerChannelEncryptor {
115-
let secp_ctx = Secp256k1::signing_only();
116-
110+
pub fn new_inbound<C: secp256k1::Signing>(our_node_secret: &SecretKey, secp_ctx: &Secp256k1<C>) -> PeerChannelEncryptor {
117111
let mut sha = Sha256::engine();
118112
sha.input(&NOISE_H);
119113
let our_node_id = PublicKey::from_secret_key(&secp_ctx, our_node_secret);
@@ -122,7 +116,6 @@ impl PeerChannelEncryptor {
122116

123117
PeerChannelEncryptor {
124118
their_node_id: None,
125-
secp_ctx,
126119
noise_state: NoiseState::InProgress {
127120
state: NoiseStep::PreActOne,
128121
directional_state: DirectionalNoiseState::Inbound {
@@ -224,7 +217,7 @@ impl PeerChannelEncryptor {
224217
Ok((their_pub, temp_k))
225218
}
226219

227-
pub fn get_act_one(&mut self) -> [u8; 50] {
220+
pub fn get_act_one<C: secp256k1::Signing>(&mut self, secp_ctx: &Secp256k1<C>) -> [u8; 50] {
228221
match self.noise_state {
229222
NoiseState::InProgress { ref mut state, ref directional_state, ref mut bidirectional_state } =>
230223
match directional_state {
@@ -233,7 +226,7 @@ impl PeerChannelEncryptor {
233226
panic!("Requested act at wrong step");
234227
}
235228

236-
let (res, _) = PeerChannelEncryptor::outbound_noise_act(&self.secp_ctx, bidirectional_state, &ie, &self.their_node_id.unwrap());
229+
let (res, _) = PeerChannelEncryptor::outbound_noise_act(secp_ctx, bidirectional_state, &ie, &self.their_node_id.unwrap());
237230
*state = NoiseStep::PostActOne;
238231
res
239232
},
@@ -243,7 +236,9 @@ impl PeerChannelEncryptor {
243236
}
244237
}
245238

246-
pub fn process_act_one_with_keys(&mut self, act_one: &[u8], our_node_secret: &SecretKey, our_ephemeral: SecretKey) -> Result<[u8; 50], LightningError> {
239+
pub fn process_act_one_with_keys<C: secp256k1::Signing>(
240+
&mut self, act_one: &[u8], our_node_secret: &SecretKey, our_ephemeral: SecretKey, secp_ctx: &Secp256k1<C>)
241+
-> Result<[u8; 50], LightningError> {
247242
assert_eq!(act_one.len(), 50);
248243

249244
match self.noise_state {
@@ -259,7 +254,8 @@ impl PeerChannelEncryptor {
259254

260255
re.get_or_insert(our_ephemeral);
261256

262-
let (res, temp_k) = PeerChannelEncryptor::outbound_noise_act(&self.secp_ctx, bidirectional_state, &re.unwrap(), &ie.unwrap());
257+
let (res, temp_k) =
258+
PeerChannelEncryptor::outbound_noise_act(secp_ctx, bidirectional_state, &re.unwrap(), &ie.unwrap());
263259
*temp_k2 = Some(temp_k);
264260
*state = NoiseStep::PostActTwo;
265261
Ok(res)
@@ -270,7 +266,9 @@ impl PeerChannelEncryptor {
270266
}
271267
}
272268

273-
pub fn process_act_two(&mut self, act_two: &[u8], our_node_secret: &SecretKey) -> Result<([u8; 66], PublicKey), LightningError> {
269+
pub fn process_act_two<C: secp256k1::Signing>(
270+
&mut self, act_two: &[u8], our_node_secret: &SecretKey, secp_ctx: &Secp256k1<C>)
271+
-> Result<([u8; 66], PublicKey), LightningError> {
274272
assert_eq!(act_two.len(), 50);
275273

276274
let final_hkdf;
@@ -286,7 +284,7 @@ impl PeerChannelEncryptor {
286284
let (re, temp_k2) = PeerChannelEncryptor::inbound_noise_act(bidirectional_state, act_two, &ie)?;
287285

288286
let mut res = [0; 66];
289-
let our_node_id = PublicKey::from_secret_key(&self.secp_ctx, &our_node_secret);
287+
let our_node_id = PublicKey::from_secret_key(secp_ctx, &our_node_secret);
290288

291289
PeerChannelEncryptor::encrypt_with_ad(&mut res[1..50], 1, &temp_k2, &bidirectional_state.h, &our_node_id.serialize()[..]);
292290

@@ -474,28 +472,31 @@ mod tests {
474472
use super::LN_MAX_MSG_LEN;
475473

476474
use bitcoin::secp256k1::{PublicKey,SecretKey};
475+
use bitcoin::secp256k1::Secp256k1;
477476

478477
use hex;
479478

480479
use ln::peer_channel_encryptor::{PeerChannelEncryptor,NoiseState};
481480

482481
fn get_outbound_peer_for_initiator_test_vectors() -> PeerChannelEncryptor {
483482
let their_node_id = PublicKey::from_slice(&hex::decode("028d7500dd4c12685d1f568b4c2b5048e8534b873319f3a8daa612b469132ec7f7").unwrap()[..]).unwrap();
483+
let secp_ctx = Secp256k1::signing_only();
484484

485485
let mut outbound_peer = PeerChannelEncryptor::new_outbound(their_node_id, SecretKey::from_slice(&hex::decode("1212121212121212121212121212121212121212121212121212121212121212").unwrap()[..]).unwrap());
486-
assert_eq!(outbound_peer.get_act_one()[..], hex::decode("00036360e856310ce5d294e8be33fc807077dc56ac80d95d9cd4ddbd21325eff73f70df6086551151f58b8afe6c195782c6a").unwrap()[..]);
486+
assert_eq!(outbound_peer.get_act_one(&secp_ctx)[..], hex::decode("00036360e856310ce5d294e8be33fc807077dc56ac80d95d9cd4ddbd21325eff73f70df6086551151f58b8afe6c195782c6a").unwrap()[..]);
487487
outbound_peer
488488
}
489489

490490
fn get_inbound_peer_for_test_vectors() -> PeerChannelEncryptor {
491491
// transport-responder successful handshake
492492
let our_node_id = SecretKey::from_slice(&hex::decode("2121212121212121212121212121212121212121212121212121212121212121").unwrap()[..]).unwrap();
493493
let our_ephemeral = SecretKey::from_slice(&hex::decode("2222222222222222222222222222222222222222222222222222222222222222").unwrap()[..]).unwrap();
494+
let secp_ctx = Secp256k1::signing_only();
494495

495-
let mut inbound_peer = PeerChannelEncryptor::new_inbound(&our_node_id);
496+
let mut inbound_peer = PeerChannelEncryptor::new_inbound(&our_node_id, &secp_ctx);
496497

497498
let act_one = hex::decode("00036360e856310ce5d294e8be33fc807077dc56ac80d95d9cd4ddbd21325eff73f70df6086551151f58b8afe6c195782c6a").unwrap().to_vec();
498-
assert_eq!(inbound_peer.process_act_one_with_keys(&act_one[..], &our_node_id, our_ephemeral.clone()).unwrap()[..], hex::decode("0002466d7fcae563e5cb09a0d1870bb580344804617879a14949cf22285f1bae3f276e2470b93aac583c9ef6eafca3f730ae").unwrap()[..]);
499+
assert_eq!(inbound_peer.process_act_one_with_keys(&act_one[..], &our_node_id, our_ephemeral.clone(), &secp_ctx).unwrap()[..], hex::decode("0002466d7fcae563e5cb09a0d1870bb580344804617879a14949cf22285f1bae3f276e2470b93aac583c9ef6eafca3f730ae").unwrap()[..]);
499500

500501
let act_three = hex::decode("00b9e3a702e93e3a9948c2ed6e5fd7590a6e1c3a0344cfc9d5b57357049aa22355361aa02e55a8fc28fef5bd6d71ad0c38228dc68b1c466263b47fdf31e560e139ba").unwrap().to_vec();
501502
// test vector doesn't specify the initiator static key, but it's the same as the one
@@ -520,13 +521,14 @@ mod tests {
520521
#[test]
521522
fn noise_initiator_test_vectors() {
522523
let our_node_id = SecretKey::from_slice(&hex::decode("1111111111111111111111111111111111111111111111111111111111111111").unwrap()[..]).unwrap();
524+
let secp_ctx = Secp256k1::signing_only();
523525

524526
{
525527
// transport-initiator successful handshake
526528
let mut outbound_peer = get_outbound_peer_for_initiator_test_vectors();
527529

528530
let act_two = hex::decode("0002466d7fcae563e5cb09a0d1870bb580344804617879a14949cf22285f1bae3f276e2470b93aac583c9ef6eafca3f730ae").unwrap().to_vec();
529-
assert_eq!(outbound_peer.process_act_two(&act_two[..], &our_node_id).unwrap().0[..], hex::decode("00b9e3a702e93e3a9948c2ed6e5fd7590a6e1c3a0344cfc9d5b57357049aa22355361aa02e55a8fc28fef5bd6d71ad0c38228dc68b1c466263b47fdf31e560e139ba").unwrap()[..]);
531+
assert_eq!(outbound_peer.process_act_two(&act_two[..], &our_node_id, &secp_ctx).unwrap().0[..], hex::decode("00b9e3a702e93e3a9948c2ed6e5fd7590a6e1c3a0344cfc9d5b57357049aa22355361aa02e55a8fc28fef5bd6d71ad0c38228dc68b1c466263b47fdf31e560e139ba").unwrap()[..]);
530532

531533
match outbound_peer.noise_state {
532534
NoiseState::Finished { sk, sn, sck, rk, rn, rck } => {
@@ -549,30 +551,31 @@ mod tests {
549551
let mut outbound_peer = get_outbound_peer_for_initiator_test_vectors();
550552

551553
let act_two = hex::decode("0102466d7fcae563e5cb09a0d1870bb580344804617879a14949cf22285f1bae3f276e2470b93aac583c9ef6eafca3f730ae").unwrap().to_vec();
552-
assert!(outbound_peer.process_act_two(&act_two[..], &our_node_id).is_err());
554+
assert!(outbound_peer.process_act_two(&act_two[..], &our_node_id, &secp_ctx).is_err());
553555
}
554556

555557
{
556558
// transport-initiator act2 bad key serialization test
557559
let mut outbound_peer = get_outbound_peer_for_initiator_test_vectors();
558560

559561
let act_two = hex::decode("0004466d7fcae563e5cb09a0d1870bb580344804617879a14949cf22285f1bae3f276e2470b93aac583c9ef6eafca3f730ae").unwrap().to_vec();
560-
assert!(outbound_peer.process_act_two(&act_two[..], &our_node_id).is_err());
562+
assert!(outbound_peer.process_act_two(&act_two[..], &our_node_id, &secp_ctx).is_err());
561563
}
562564

563565
{
564566
// transport-initiator act2 bad MAC test
565567
let mut outbound_peer = get_outbound_peer_for_initiator_test_vectors();
566568

567569
let act_two = hex::decode("0002466d7fcae563e5cb09a0d1870bb580344804617879a14949cf22285f1bae3f276e2470b93aac583c9ef6eafca3f730af").unwrap().to_vec();
568-
assert!(outbound_peer.process_act_two(&act_two[..], &our_node_id).is_err());
570+
assert!(outbound_peer.process_act_two(&act_two[..], &our_node_id, &secp_ctx).is_err());
569571
}
570572
}
571573

572574
#[test]
573575
fn noise_responder_test_vectors() {
574576
let our_node_id = SecretKey::from_slice(&hex::decode("2121212121212121212121212121212121212121212121212121212121212121").unwrap()[..]).unwrap();
575577
let our_ephemeral = SecretKey::from_slice(&hex::decode("2222222222222222222222222222222222222222222222222222222222222222").unwrap()[..]).unwrap();
578+
let secp_ctx = Secp256k1::signing_only();
576579

577580
{
578581
let _ = get_inbound_peer_for_test_vectors();
@@ -583,31 +586,31 @@ mod tests {
583586
}
584587
{
585588
// transport-responder act1 bad version test
586-
let mut inbound_peer = PeerChannelEncryptor::new_inbound(&our_node_id);
589+
let mut inbound_peer = PeerChannelEncryptor::new_inbound(&our_node_id, &secp_ctx);
587590

588591
let act_one = hex::decode("01036360e856310ce5d294e8be33fc807077dc56ac80d95d9cd4ddbd21325eff73f70df6086551151f58b8afe6c195782c6a").unwrap().to_vec();
589-
assert!(inbound_peer.process_act_one_with_keys(&act_one[..], &our_node_id, our_ephemeral.clone()).is_err());
592+
assert!(inbound_peer.process_act_one_with_keys(&act_one[..], &our_node_id, our_ephemeral.clone(), &secp_ctx).is_err());
590593
}
591594
{
592595
// transport-responder act1 bad key serialization test
593-
let mut inbound_peer = PeerChannelEncryptor::new_inbound(&our_node_id);
596+
let mut inbound_peer = PeerChannelEncryptor::new_inbound(&our_node_id, &secp_ctx);
594597

595598
let act_one =hex::decode("00046360e856310ce5d294e8be33fc807077dc56ac80d95d9cd4ddbd21325eff73f70df6086551151f58b8afe6c195782c6a").unwrap().to_vec();
596-
assert!(inbound_peer.process_act_one_with_keys(&act_one[..], &our_node_id, our_ephemeral.clone()).is_err());
599+
assert!(inbound_peer.process_act_one_with_keys(&act_one[..], &our_node_id, our_ephemeral.clone(), &secp_ctx).is_err());
597600
}
598601
{
599602
// transport-responder act1 bad MAC test
600-
let mut inbound_peer = PeerChannelEncryptor::new_inbound(&our_node_id);
603+
let mut inbound_peer = PeerChannelEncryptor::new_inbound(&our_node_id, &secp_ctx);
601604

602605
let act_one = hex::decode("00036360e856310ce5d294e8be33fc807077dc56ac80d95d9cd4ddbd21325eff73f70df6086551151f58b8afe6c195782c6b").unwrap().to_vec();
603-
assert!(inbound_peer.process_act_one_with_keys(&act_one[..], &our_node_id, our_ephemeral.clone()).is_err());
606+
assert!(inbound_peer.process_act_one_with_keys(&act_one[..], &our_node_id, our_ephemeral.clone(), &secp_ctx).is_err());
604607
}
605608
{
606609
// transport-responder act3 bad version test
607-
let mut inbound_peer = PeerChannelEncryptor::new_inbound(&our_node_id);
610+
let mut inbound_peer = PeerChannelEncryptor::new_inbound(&our_node_id, &secp_ctx);
608611

609612
let act_one = hex::decode("00036360e856310ce5d294e8be33fc807077dc56ac80d95d9cd4ddbd21325eff73f70df6086551151f58b8afe6c195782c6a").unwrap().to_vec();
610-
assert_eq!(inbound_peer.process_act_one_with_keys(&act_one[..], &our_node_id, our_ephemeral.clone()).unwrap()[..], hex::decode("0002466d7fcae563e5cb09a0d1870bb580344804617879a14949cf22285f1bae3f276e2470b93aac583c9ef6eafca3f730ae").unwrap()[..]);
613+
assert_eq!(inbound_peer.process_act_one_with_keys(&act_one[..], &our_node_id, our_ephemeral.clone(), &secp_ctx).unwrap()[..], hex::decode("0002466d7fcae563e5cb09a0d1870bb580344804617879a14949cf22285f1bae3f276e2470b93aac583c9ef6eafca3f730ae").unwrap()[..]);
611614

612615
let act_three = hex::decode("01b9e3a702e93e3a9948c2ed6e5fd7590a6e1c3a0344cfc9d5b57357049aa22355361aa02e55a8fc28fef5bd6d71ad0c38228dc68b1c466263b47fdf31e560e139ba").unwrap().to_vec();
613616
assert!(inbound_peer.process_act_three(&act_three[..]).is_err());
@@ -618,30 +621,30 @@ mod tests {
618621
}
619622
{
620623
// transport-responder act3 bad MAC for ciphertext test
621-
let mut inbound_peer = PeerChannelEncryptor::new_inbound(&our_node_id);
624+
let mut inbound_peer = PeerChannelEncryptor::new_inbound(&our_node_id, &secp_ctx);
622625

623626
let act_one = hex::decode("00036360e856310ce5d294e8be33fc807077dc56ac80d95d9cd4ddbd21325eff73f70df6086551151f58b8afe6c195782c6a").unwrap().to_vec();
624-
assert_eq!(inbound_peer.process_act_one_with_keys(&act_one[..], &our_node_id, our_ephemeral.clone()).unwrap()[..], hex::decode("0002466d7fcae563e5cb09a0d1870bb580344804617879a14949cf22285f1bae3f276e2470b93aac583c9ef6eafca3f730ae").unwrap()[..]);
627+
assert_eq!(inbound_peer.process_act_one_with_keys(&act_one[..], &our_node_id, our_ephemeral.clone(), &secp_ctx).unwrap()[..], hex::decode("0002466d7fcae563e5cb09a0d1870bb580344804617879a14949cf22285f1bae3f276e2470b93aac583c9ef6eafca3f730ae").unwrap()[..]);
625628

626629
let act_three = hex::decode("00c9e3a702e93e3a9948c2ed6e5fd7590a6e1c3a0344cfc9d5b57357049aa22355361aa02e55a8fc28fef5bd6d71ad0c38228dc68b1c466263b47fdf31e560e139ba").unwrap().to_vec();
627630
assert!(inbound_peer.process_act_three(&act_three[..]).is_err());
628631
}
629632
{
630633
// transport-responder act3 bad rs test
631-
let mut inbound_peer = PeerChannelEncryptor::new_inbound(&our_node_id);
634+
let mut inbound_peer = PeerChannelEncryptor::new_inbound(&our_node_id, &secp_ctx);
632635

633636
let act_one = hex::decode("00036360e856310ce5d294e8be33fc807077dc56ac80d95d9cd4ddbd21325eff73f70df6086551151f58b8afe6c195782c6a").unwrap().to_vec();
634-
assert_eq!(inbound_peer.process_act_one_with_keys(&act_one[..], &our_node_id, our_ephemeral.clone()).unwrap()[..], hex::decode("0002466d7fcae563e5cb09a0d1870bb580344804617879a14949cf22285f1bae3f276e2470b93aac583c9ef6eafca3f730ae").unwrap()[..]);
637+
assert_eq!(inbound_peer.process_act_one_with_keys(&act_one[..], &our_node_id, our_ephemeral.clone(), &secp_ctx).unwrap()[..], hex::decode("0002466d7fcae563e5cb09a0d1870bb580344804617879a14949cf22285f1bae3f276e2470b93aac583c9ef6eafca3f730ae").unwrap()[..]);
635638

636639
let act_three = hex::decode("00bfe3a702e93e3a9948c2ed6e5fd7590a6e1c3a0344cfc9d5b57357049aa2235536ad09a8ee351870c2bb7f78b754a26c6cef79a98d25139c856d7efd252c2ae73c").unwrap().to_vec();
637640
assert!(inbound_peer.process_act_three(&act_three[..]).is_err());
638641
}
639642
{
640643
// transport-responder act3 bad MAC test
641-
let mut inbound_peer = PeerChannelEncryptor::new_inbound(&our_node_id);
644+
let mut inbound_peer = PeerChannelEncryptor::new_inbound(&our_node_id, &secp_ctx);
642645

643646
let act_one = hex::decode("00036360e856310ce5d294e8be33fc807077dc56ac80d95d9cd4ddbd21325eff73f70df6086551151f58b8afe6c195782c6a").unwrap().to_vec();
644-
assert_eq!(inbound_peer.process_act_one_with_keys(&act_one[..], &our_node_id, our_ephemeral.clone()).unwrap()[..], hex::decode("0002466d7fcae563e5cb09a0d1870bb580344804617879a14949cf22285f1bae3f276e2470b93aac583c9ef6eafca3f730ae").unwrap()[..]);
647+
assert_eq!(inbound_peer.process_act_one_with_keys(&act_one[..], &our_node_id, our_ephemeral.clone(), &secp_ctx).unwrap()[..], hex::decode("0002466d7fcae563e5cb09a0d1870bb580344804617879a14949cf22285f1bae3f276e2470b93aac583c9ef6eafca3f730ae").unwrap()[..]);
645648

646649
let act_three = hex::decode("00b9e3a702e93e3a9948c2ed6e5fd7590a6e1c3a0344cfc9d5b57357049aa22355361aa02e55a8fc28fef5bd6d71ad0c38228dc68b1c466263b47fdf31e560e139bb").unwrap().to_vec();
647650
assert!(inbound_peer.process_act_three(&act_three[..]).is_err());
@@ -654,12 +657,13 @@ mod tests {
654657
// We use the same keys as the initiator and responder test vectors, so we copy those tests
655658
// here and use them to encrypt.
656659
let mut outbound_peer = get_outbound_peer_for_initiator_test_vectors();
660+
let secp_ctx = Secp256k1::signing_only();
657661

658662
{
659663
let our_node_id = SecretKey::from_slice(&hex::decode("1111111111111111111111111111111111111111111111111111111111111111").unwrap()[..]).unwrap();
660664

661665
let act_two = hex::decode("0002466d7fcae563e5cb09a0d1870bb580344804617879a14949cf22285f1bae3f276e2470b93aac583c9ef6eafca3f730ae").unwrap().to_vec();
662-
assert_eq!(outbound_peer.process_act_two(&act_two[..], &our_node_id).unwrap().0[..], hex::decode("00b9e3a702e93e3a9948c2ed6e5fd7590a6e1c3a0344cfc9d5b57357049aa22355361aa02e55a8fc28fef5bd6d71ad0c38228dc68b1c466263b47fdf31e560e139ba").unwrap()[..]);
666+
assert_eq!(outbound_peer.process_act_two(&act_two[..], &our_node_id, &secp_ctx).unwrap().0[..], hex::decode("00b9e3a702e93e3a9948c2ed6e5fd7590a6e1c3a0344cfc9d5b57357049aa22355361aa02e55a8fc28fef5bd6d71ad0c38228dc68b1c466263b47fdf31e560e139ba").unwrap()[..]);
663667

664668
match outbound_peer.noise_state {
665669
NoiseState::Finished { sk, sn, sck, rk, rn, rck } => {

0 commit comments

Comments
 (0)