mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 14:01:02 +00:00
grandpa: voting rules shouldn't restrict past round base (#4150)
This commit is contained in:
@@ -497,8 +497,18 @@ where
|
|||||||
// note that we pass the original `best_header`, i.e. before the
|
// note that we pass the original `best_header`, i.e. before the
|
||||||
// authority set limit filter, which can be considered a
|
// authority set limit filter, which can be considered a
|
||||||
// mandatory/implicit voting rule.
|
// mandatory/implicit voting rule.
|
||||||
|
//
|
||||||
|
// we also make sure that the restricted vote is higher than the
|
||||||
|
// round base (i.e. last finalized), otherwise the value
|
||||||
|
// returned by the given voting rule is ignored and the original
|
||||||
|
// target is used instead.
|
||||||
self.voting_rule
|
self.voting_rule
|
||||||
.restrict_vote(&*self.client, &base_header, &best_header, target_header)
|
.restrict_vote(&*self.client, &base_header, &best_header, target_header)
|
||||||
|
.filter(|(_, restricted_number)| {
|
||||||
|
// we can only restrict votes within the interval [base, target]
|
||||||
|
restricted_number > base_header.number() &&
|
||||||
|
restricted_number < target_header.number()
|
||||||
|
})
|
||||||
.or(Some((target_header.hash(), *target_header.number())))
|
.or(Some((target_header.hash(), *target_header.number())))
|
||||||
},
|
},
|
||||||
Ok(None) => {
|
Ok(None) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user