mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 15:11:02 +00:00
Validator side of the collation protocol. (#295)
* skeleton of collators object * awaiting and handling collations. rename `collators` to CollationPool * add some tests * add tests * implement Collators trait for ConsensusNetwork * plug collators into main polkadot-network * ignore collator role message * add a couple more tests * garbage collection for collations * ensure disconnected backup collator is removed from pool * address other grumbles
This commit is contained in:
committed by
Gav Wood
parent
907eeef9dd
commit
88c40c8fb4
@@ -144,7 +144,7 @@ pub struct CandidateReceipt {
|
||||
pub parachain_index: Id,
|
||||
/// The collator's relay-chain account ID
|
||||
pub collator: super::AccountId,
|
||||
/// Signature on block data by collator.
|
||||
/// Signature on blake2-256 of the block data by collator.
|
||||
pub signature: CandidateSignature,
|
||||
/// The head-data
|
||||
pub head_data: HeadData,
|
||||
@@ -195,6 +195,17 @@ impl CandidateReceipt {
|
||||
use runtime_primitives::traits::{BlakeTwo256, Hash};
|
||||
BlakeTwo256::hash_of(self)
|
||||
}
|
||||
|
||||
/// Check integrity vs. provided block data.
|
||||
pub fn check_signature(&self) -> Result<(), ()> {
|
||||
use runtime_primitives::traits::Verify;
|
||||
|
||||
if self.signature.verify(&self.block_data_hash.0[..], &self.collator) {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialOrd for CandidateReceipt {
|
||||
|
||||
Reference in New Issue
Block a user