mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-11 16:31:07 +00:00
Send back empty votes + log in approval-voting in case candidate entry is missing. (#5925)
* Send back empty votes + log. * Update node/core/approval-voting/src/lib.rs Co-authored-by: Andrei Sandu <54316454+sandreim@users.noreply.github.com> Co-authored-by: Andrei Sandu <54316454+sandreim@users.noreply.github.com>
This commit is contained in:
@@ -1210,8 +1210,24 @@ async fn get_approval_signatures_for_candidate<Context>(
|
||||
candidate_hash: CandidateHash,
|
||||
tx: oneshot::Sender<HashMap<ValidatorIndex, ValidatorSignature>>,
|
||||
) -> SubsystemResult<()> {
|
||||
let send_votes = |votes| {
|
||||
if let Err(_) = tx.send(votes) {
|
||||
gum::debug!(
|
||||
target: LOG_TARGET,
|
||||
"Sending approval signatures back failed, as receiver got closed."
|
||||
);
|
||||
}
|
||||
};
|
||||
let entry = match db.load_candidate_entry(&candidate_hash)? {
|
||||
None => return Ok(()),
|
||||
None => {
|
||||
send_votes(HashMap::new());
|
||||
gum::debug!(
|
||||
target: LOG_TARGET,
|
||||
?candidate_hash,
|
||||
"Sent back empty votes because the candidate was not found in db."
|
||||
);
|
||||
return Ok(())
|
||||
},
|
||||
Some(e) => e,
|
||||
};
|
||||
|
||||
@@ -1261,13 +1277,7 @@ async fn get_approval_signatures_for_candidate<Context>(
|
||||
target: LOG_TARGET,
|
||||
"Request for approval signatures got cancelled by `approval-distribution`."
|
||||
),
|
||||
Some(Ok(votes)) =>
|
||||
if let Err(_) = tx.send(votes) {
|
||||
gum::debug!(
|
||||
target: LOG_TARGET,
|
||||
"Sending approval signatures back failed, as receiver got closed"
|
||||
);
|
||||
},
|
||||
Some(Ok(votes)) => send_votes(votes),
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user