Tone down warnings when resubmitting to the pool. (#4294)

* Tone down warnings.

* Fix the fix.

* Add some debug info.

* More logs.

* Update logging.
This commit is contained in:
Tomasz Drwięga
2019-12-05 13:02:22 +01:00
committed by Gavin Wood
parent c42cdf185c
commit 7714bfca8e
2 changed files with 10 additions and 6 deletions
@@ -91,8 +91,12 @@ impl<H: hash::Hash + traits::Member + Serialize, H2: Clone + fmt::Debug> Listene
}
/// Transaction was removed as invalid.
pub fn invalid(&mut self, tx: &H) {
warn!(target: "txpool", "Extrinsic invalid: {:?}", tx);
pub fn invalid(&mut self, tx: &H, warn: bool) {
if warn {
warn!(target: "txpool", "Extrinsic invalid: {:?}", tx);
} else {
debug!(target: "txpool", "Extrinsic invalid: {:?}", tx);
}
self.fire(tx, |watcher| watcher.invalid());
}
@@ -138,7 +138,7 @@ impl<B: ChainApi> ValidatedPool<B> {
Err(err.into())
},
ValidatedTransaction::Unknown(hash, err) => {
self.listener.write().invalid(&hash);
self.listener.write().invalid(&hash, false);
Err(err.into())
}
}
@@ -311,8 +311,8 @@ impl<B: ChainApi> ValidatedPool<B> {
match final_status {
Status::Future => listener.future(&hash),
Status::Ready => listener.ready(&hash, None),
Status::Failed => listener.invalid(&hash),
Status::Dropped => listener.dropped(&hash, None),
Status::Failed => listener.invalid(&hash, initial_status.is_some()),
}
}
}
@@ -478,7 +478,7 @@ impl<B: ChainApi> ValidatedPool<B> {
let mut listener = self.listener.write();
for tx in &invalid {
listener.invalid(&tx.hash);
listener.invalid(&tx.hash, true);
}
invalid
@@ -506,7 +506,7 @@ fn fire_events<H, H2, Ex>(
base::Imported::Ready { ref promoted, ref failed, ref removed, ref hash } => {
listener.ready(hash, None);
for f in failed {
listener.invalid(f);
listener.invalid(f, true);
}
for r in removed {
listener.dropped(&r.hash, Some(hash));