You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: connect to bootnodes and request peer data (#118)
**Motivation**
Build the functionality to join the network
**Description**
Closes#86
---------
Co-authored-by: Tomás Grüner <47506558+MegaRedHand@users.noreply.github.com>
let signer = SigningKey::from_slice(key_bytes.as_bytes()).unwrap();
377
384
378
385
letmut buf = Vec::new();
379
386
380
-
msg.encode_with_header(&mut buf, signer);
387
+
msg.encode_with_header(&mut buf,&signer);
381
388
let result = to_hex(&buf);
382
-
let hash = "852ef38c2087413400cb33215709a8cfa6f274929e91704ec27a1ae4d226f85d";
383
-
let signature = "a7ab61ec963f779d10918c9bc3c3243c05f45eabbd078e90bf78313904e1c91201a03e78a133c2676e1c2686601e70ab1ec7aa602ad7f65bb468e52367d7123c00";
389
+
let hash = "9657e4e2db33b51cbbeb503bd195efcf081d6a83befbb42b4be95d0f7bf27ffe";
390
+
let signature = "b1a91caa6105b941d3ecce052dcfea5e4f4290c9e6a89ff72707a8b5116ee87a1ea3fa0086990cd862a8a2347f346f1b118122a28bf2ed2ca371d2c493a86bde01";
384
391
let pkt_type = "02";
385
392
let msg = "f7c984bebfbc3982765f80a03e1bf98f025f98d54ed2f61bbef63b6b46f50e12d7b937d6bdea19afd640be2384667d9af086018cf3c3bcdd";
386
393
let expected = [hash, signature, pkt_type, msg].concat();
@@ -407,14 +414,13 @@ mod tests {
407
414
408
415
letmut buf = Vec::new();
409
416
410
-
msg.encode_with_header(&mut buf, signer);
417
+
msg.encode_with_header(&mut buf,&signer);
411
418
let result = to_hex(&buf);
412
-
let hash = "cccfa9bf8e49603f8cc5381579d435bd322d386091732e3da7f6b7df13172b92";
413
-
let signature = "b1caebcd4d754552be21df4a100bd4ccd85e9d95b2e29b29db2df681c17c370068e410ea31e7106081c2ed39489c1762125cbd34477b41d940d230d1d3888a4101";
419
+
let hash = "58a1d0ea66afd9617c198b60a7417637ae27b847b004dbebc1e29d4067327e35";
420
+
let signature = "e1988832d7d7b73925ec584ff818ff3a7bffe1a84fe3835923c3ab17af40071f7c9263176203c80c6ed77f0586479b78884e9e47fdb3287d2aafa92348e5c16700";
414
421
let pkt_type = "02";
415
422
let msg = "f0c984bebfbc3982765f80a03e1bf98f025f98d54ed2f61bbef63b6b46f50e12d7b937d6bdea19afd640be2384667d9af0";
416
423
let expected = [hash, signature, pkt_type, msg].concat();
417
-
418
424
assert_eq!(result, expected);
419
425
}
420
426
@@ -432,13 +438,14 @@ mod tests {
432
438
433
439
letmut buf = Vec::new();
434
440
435
-
msg.encode_with_header(&mut buf, signer);
441
+
msg.encode_with_header(&mut buf,&signer);
436
442
let result = to_hex(&buf);
437
-
let hash = "dabe1b1a4dc26324120594091bb94dbdd4aa98326cbfecb60a4a67778ebb0e67";
438
-
let signature = "28cf71e9a929fa29f4e528f5fdc96e25a3086a777c8967710ddc1ef5f456bae40808baf0840d0449ea5a17ba11bbb012719e679cf3cf8d137106884c393ef15b00";
443
+
let hash = "23770430fc208bdc78bc77052bf7ec2e928b38c13c085b87491c15ebebb2050f";
444
+
let signature = "7c98bb4759569117031a9fbbeb00314d018eba55135c65ee98dbf6871aaebe61225f36b36e4f60da5b5d6c917e3589dd235acfacc6de4dade116c4bb851b884b01";
439
445
let pkt_type = "03";
440
446
let encoded_message = "f848b840d860a01f9722d78051619d1e2351aba3f43f943f6f00718d1b9baa4101932a1f5011f16bb2b1bb35db20d6fe28fa0bf09636d26a87d31de9ec6203eeedb1f666850400e78bba";
441
447
let expected = [hash, signature, pkt_type, encoded_message].concat();
448
+
442
449
assert_eq!(result, expected);
443
450
}
444
451
@@ -526,7 +533,7 @@ mod tests {
526
533
527
534
letmut buf = Vec::new();
528
535
529
-
msg.encode_with_header(&mut buf, signer.clone());
536
+
msg.encode_with_header(&mut buf,&signer);
530
537
let result = Message::decode_with_header(&buf).expect("Failed decoding PingMessage");
531
538
assert_eq!(result, msg);
532
539
}
@@ -556,7 +563,7 @@ mod tests {
556
563
557
564
letmut buf = Vec::new();
558
565
559
-
msg.encode_with_header(&mut buf, signer.clone());
566
+
msg.encode_with_header(&mut buf,&signer);
560
567
let result = Message::decode_with_header(&buf).expect("Failed decoding PingMessage");
561
568
assert_eq!(result, msg);
562
569
}
@@ -574,7 +581,7 @@ mod tests {
574
581
575
582
letmut buf = Vec::new();
576
583
577
-
msg.encode_with_header(&mut buf, signer);
584
+
msg.encode_with_header(&mut buf,&signer);
578
585
let result = Message::decode_with_header(&buf).unwrap();
0 commit comments