mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-11 18:04:18 +00:00
Event-based block lookup tests (#5534)
* WIP * Initial working version of new sync tests. * Remove sync traits and fix lints. * Reduce internal method visibility and make test method instead. Remove extra beacon chain harness instance created in tests. * Improve `SyncTester` api. * Fix lint. * Test example * Lookup tests using rig * Tests should interface with events only * lint * Skip deneb test pre-deneb * Add more assertions * Remove logging changes * Address @jimmygchen comments * Merge branch 'unstable' of https://github.com/sigp/lighthouse into bn-p2p-tests * remove unused assertions * fix lint
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
use crate::discovery::CombinedKey;
|
||||
use crate::{metrics, multiaddr::Multiaddr, types::Subnet, Enr, Gossipsub, PeerId};
|
||||
use peer_info::{ConnectionDirection, PeerConnectionStatus, PeerInfo};
|
||||
use rand::seq::SliceRandom;
|
||||
@@ -671,6 +672,20 @@ impl<E: EthSpec> PeerDB<E> {
|
||||
);
|
||||
}
|
||||
|
||||
/// Updates the connection state. MUST ONLY BE USED IN TESTS.
|
||||
pub fn __add_connected_peer_testing_only(&mut self, peer_id: &PeerId) -> Option<BanOperation> {
|
||||
let enr_key = CombinedKey::generate_secp256k1();
|
||||
let enr = Enr::builder().build(&enr_key).unwrap();
|
||||
self.update_connection_state(
|
||||
peer_id,
|
||||
NewConnectionState::Connected {
|
||||
enr: Some(enr),
|
||||
seen_address: Multiaddr::empty(),
|
||||
direction: ConnectionDirection::Outgoing,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
/// The connection state of the peer has been changed. Modify the peer in the db to ensure all
|
||||
/// variables are in sync with libp2p.
|
||||
/// Updating the state can lead to a `BanOperation` which needs to be processed via the peer
|
||||
|
||||
Reference in New Issue
Block a user