consensus: improve checkpoint request replacement diagnostics
This commit is contained in:
parent
a3ab589d89
commit
aa8d95bd23
|
|
@ -454,12 +454,7 @@ where
|
||||||
let height = match self.check_block(&block) {
|
let height = match self.check_block(&block) {
|
||||||
Ok(height) => height,
|
Ok(height) => height,
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
// Block errors happen frequently on mainnet, due to bad peers.
|
tx.send(Err(error)).expect("rx has not been dropped yet");
|
||||||
tracing::trace!(?error);
|
|
||||||
|
|
||||||
// Sending might fail, depending on what the caller does with rx,
|
|
||||||
// but there's nothing we can do about it.
|
|
||||||
let _ = tx.send(Err(error));
|
|
||||||
return rx;
|
return rx;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -474,11 +469,12 @@ where
|
||||||
|
|
||||||
let hash = block.hash();
|
let hash = block.hash();
|
||||||
|
|
||||||
|
// Replace older requests by newer ones by swapping the oneshot.
|
||||||
for qb in qblocks.iter_mut() {
|
for qb in qblocks.iter_mut() {
|
||||||
if qb.hash == hash {
|
if qb.hash == hash {
|
||||||
let old_tx = std::mem::replace(&mut qb.tx, tx);
|
|
||||||
let e = VerifyCheckpointError::NewerRequest { height, hash };
|
let e = VerifyCheckpointError::NewerRequest { height, hash };
|
||||||
tracing::trace!(?e);
|
tracing::trace!(?e, "failing older of duplicate requests");
|
||||||
|
let old_tx = std::mem::replace(&mut qb.tx, tx);
|
||||||
let _ = old_tx.send(Err(e));
|
let _ = old_tx.send(Err(e));
|
||||||
return rx;
|
return rx;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue