AFG messaging (#210)

* First draft of afg messaging

* AfgReceivedPrevote, AfgReceivedPrecommit and AfgFinalized added to rust backend

* Tidy up
This commit is contained in:
Maciej Hirsz
2019-12-06 18:21:25 +01:00
committed by GitHub
parent 92fb9d28de
commit 0a89382127
7 changed files with 190 additions and 10 deletions
+37 -4
View File
@@ -37,13 +37,13 @@ pub enum Details {
#[serde(rename = "txpool.import")]
TxPoolImport(IgnoredAny),
#[serde(rename = "afg.finalized")]
AfgFinalized(IgnoredAny),
AfgFinalized(AfgFinalized),
#[serde(rename = "afg.received_precommit")]
AfgReceivedPrecommit(IgnoredAny),
AfgReceivedPrecommit(AfgReceivedPrecommit),
#[serde(rename = "afg.received_prevote")]
AfgReceivedPrevote(IgnoredAny),
AfgReceivedPrevote(AfgReceivedPrevote),
#[serde(rename = "afg.received_commit")]
AfgReceivedCommit(IgnoredAny),
AfgReceivedCommit(AfgReceivedCommit),
#[serde(rename = "afg.authority_set")]
AfgAuthoritySet(AfgAuthoritySet),
#[serde(rename = "afg.finalized_blocks_up_to")]
@@ -86,6 +86,39 @@ pub struct Finalized {
#[derive(Deserialize, Debug)]
pub struct AfgAuthoritySet {
pub authority_id: Box<str>,
pub authorities: Box<str>,
pub authority_set_id: Box<str>,
}
#[derive(Deserialize, Debug, Clone)]
pub struct AfgFinalized {
pub finalized_hash: BlockHash,
pub finalized_number: Box<str>,
}
#[derive(Deserialize, Debug, Clone)]
pub struct AfgReceived {
pub target_hash: BlockHash,
pub target_number: Box<str>,
pub voter: Box<str>,
}
#[derive(Deserialize, Debug, Clone)]
pub struct AfgReceivedPrecommit {
#[serde(flatten)]
pub received: AfgReceived,
}
#[derive(Deserialize, Debug, Clone)]
pub struct AfgReceivedPrevote {
#[serde(flatten)]
pub received: AfgReceived,
}
#[derive(Deserialize, Debug, Clone)]
pub struct AfgReceivedCommit {
#[serde(flatten)]
pub received: AfgReceived,
}
impl Block {