StatementDistributionMessage::get_metadata is a footgun and should be removed (#5101)

* remove get_metadata method

* cargo fmt

* add get_metadata function in test

* cargo fmt

* Update node/network/statement-distribution/src/tests.rs

Co-authored-by: Robert Habermeier <rphmeier@gmail.com>

* update

* update

Co-authored-by: Robert Habermeier <rphmeier@gmail.com>
This commit is contained in:
Doordashcon
2022-03-15 12:52:01 +01:00
committed by GitHub
parent 3a862e2a54
commit b72bd9ef6c
2 changed files with 17 additions and 24 deletions
-13
View File
@@ -332,19 +332,6 @@ pub mod v1 {
}
impl StatementDistributionMessage {
/// Get meta data of the given `StatementDistributionMessage`.
pub fn get_metadata(&self) -> StatementMetadata {
match self {
Self::Statement(relay_parent, statement) => StatementMetadata {
relay_parent: *relay_parent,
candidate_hash: statement.unchecked_payload().candidate_hash(),
signed_by: statement.unchecked_validator_index(),
signature: statement.unchecked_signature().clone(),
},
Self::LargeStatement(metadata) => metadata.clone(),
}
}
/// Get fingerprint describing the contained statement uniquely.
pub fn get_fingerprint(&self) -> (CompactStatement, ValidatorIndex) {
match self {