Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix skipping blocks in sync client. #354

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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