Skip to content

Commit

Permalink
Fix skipping blocks in sync client.
Browse files Browse the repository at this point in the history
  • Loading branch information
aterentic-ethernal committed Nov 21, 2023
1 parent 55acae7 commit 5203236
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 173 deletions.
11 changes: 0 additions & 11 deletions src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,6 @@ pub fn get_block_header_from_db(db: Arc<DB>, block_number: u32) -> Result<Option
.transpose()
}

/// Checks if block header for given block number is in database
pub fn is_block_header_in_db(db: Arc<DB>, block_number: u32) -> Result<bool> {
let handle = db
.cf_handle(BLOCK_HEADER_CF)
.context("Failed to get cf handle")?;

db.get_pinned_cf(&handle, block_number.to_be_bytes())
.context("Failed to get block header")
.map(|value| value.is_some())
}

/// Stores block header into database under the given block number key
pub fn store_block_header_in_db(db: Arc<DB>, block_number: u32, header: &DaHeader) -> Result<()> {
let handle = db
Expand Down
5 changes: 0 additions & 5 deletions src/network/rpc/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -734,11 +734,6 @@ impl Client {
.map(|header| (header, hash))
}

// pub async fn get_connected_node(&self) -> Result<Node> {
// self.execute_sync(|response_sender| GetConnectedNode { response_sender })
// .await
// }

pub async fn get_validator_set_at(&self, block_hash: H256) -> Result<Option<Vec<AccountId32>>> {
self.execute_sync(|response_sender| {
Box::new(GetValidatorSetAt {
Expand Down
5 changes: 2 additions & 3 deletions src/network/rpc/event_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ mod tests {
use hex::FromHex;
use sp_core::{
ed25519::{self, Public, Signature},
Pair, H256,
Pair,
};
use test_case::test_case;

Expand Down Expand Up @@ -558,7 +558,6 @@ mod tests {
&set_id,
));

let is_ok = <ed25519::Pair as Pair>::verify(&sig, &signed_message, &id);
is_ok
<ed25519::Pair as Pair>::verify(&sig, signed_message, &id)
}
}
Loading

0 comments on commit 5203236

Please sign in to comment.