mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 13:17:56 +00:00
send GRANDPA messages without holding validator lock (#2537)
This commit is contained in:
committed by
GitHub
parent
6c41d0b3ec
commit
6cd82ca747
@@ -594,24 +594,30 @@ impl<Block: BlockT> GossipValidator<Block> {
|
||||
pub(super) fn note_round<F>(&self, round: Round, set_id: SetId, send_neighbor: F)
|
||||
where F: FnOnce(Vec<PeerId>, NeighborPacket<NumberFor<Block>>)
|
||||
{
|
||||
self.inner.write().note_round(round, set_id)
|
||||
.map(|(to, msg)| send_neighbor(to, msg));
|
||||
let maybe_msg = self.inner.write().note_round(round, set_id);
|
||||
if let Some((to, msg)) = maybe_msg {
|
||||
send_neighbor(to, msg);
|
||||
}
|
||||
}
|
||||
|
||||
/// Note that a voter set with given ID has started.
|
||||
pub(super) fn note_set<F>(&self, set_id: SetId, send_neighbor: F)
|
||||
where F: FnOnce(Vec<PeerId>, NeighborPacket<NumberFor<Block>>)
|
||||
{
|
||||
self.inner.write().note_set(set_id)
|
||||
.map(|(to, msg)| send_neighbor(to, msg));
|
||||
let maybe_msg = self.inner.write().note_set(set_id);
|
||||
if let Some((to, msg)) = maybe_msg {
|
||||
send_neighbor(to, msg);
|
||||
}
|
||||
}
|
||||
|
||||
/// Note that we've imported a commit finalizing a given block.
|
||||
pub(super) fn note_commit_finalized<F>(&self, finalized: NumberFor<Block>, send_neighbor: F)
|
||||
where F: FnOnce(Vec<PeerId>, NeighborPacket<NumberFor<Block>>)
|
||||
{
|
||||
self.inner.write().note_commit_finalized(finalized)
|
||||
.map(|(to, msg)| send_neighbor(to, msg));
|
||||
let maybe_msg = self.inner.write().note_commit_finalized(finalized);
|
||||
if let Some((to, msg)) = maybe_msg {
|
||||
send_neighbor(to, msg);
|
||||
}
|
||||
}
|
||||
|
||||
fn report(&self, who: PeerId, cost_benefit: i32) {
|
||||
|
||||
Reference in New Issue
Block a user