-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
evm: Implement eth_syncing RPC (#2049)
* Implement eth_syncing RPC * Remove old imports * Fix segfault * Add starting block data * Format * Fix formatting
- Loading branch information
Showing
8 changed files
with
124 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use primitive_types::U256; | ||
use serde::{Serialize, Serializer}; | ||
|
||
#[derive(Debug, Serialize, Deserialize, Clone)] | ||
pub struct SyncInfo { | ||
pub starting_block: U256, | ||
pub current_block: U256, | ||
pub highest_block: U256, | ||
} | ||
|
||
/// Sync state | ||
#[derive(Debug, Deserialize, Clone)] | ||
pub enum SyncState { | ||
/// Only hashes | ||
Synced(bool), | ||
/// Full transactions | ||
Syncing(SyncInfo), | ||
} | ||
|
||
impl Serialize for SyncState { | ||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> | ||
where | ||
S: Serializer, | ||
{ | ||
match *self { | ||
SyncState::Synced(ref sync) => sync.serialize(serializer), | ||
SyncState::Syncing(ref sync_info) => sync_info.serialize(serializer), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters