mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-30 23:37:56 +00:00
Use LOG_TARGET in consensus related crates (#12875)
* Use shared LOG_TARGET in consensus related crates * Rename target from "afg" to "grandpa"
This commit is contained in:
@@ -67,6 +67,8 @@ use sp_runtime::{
|
||||
};
|
||||
use std::{cmp::Ordering, collections::HashMap, marker::PhantomData, sync::Arc, time::Duration};
|
||||
|
||||
const LOG_TARGET: &str = "pow";
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum Error<B: BlockT> {
|
||||
#[error("Header uses the wrong engine {0:?}")]
|
||||
@@ -531,7 +533,7 @@ where
|
||||
}
|
||||
|
||||
if sync_oracle.is_major_syncing() {
|
||||
debug!(target: "pow", "Skipping proposal due to sync.");
|
||||
debug!(target: LOG_TARGET, "Skipping proposal due to sync.");
|
||||
worker.on_major_syncing();
|
||||
continue
|
||||
}
|
||||
@@ -540,7 +542,7 @@ where
|
||||
Ok(x) => x,
|
||||
Err(err) => {
|
||||
warn!(
|
||||
target: "pow",
|
||||
target: LOG_TARGET,
|
||||
"Unable to pull new block for authoring. \
|
||||
Select best chain error: {}",
|
||||
err
|
||||
@@ -561,7 +563,7 @@ where
|
||||
Ok(x) => x,
|
||||
Err(err) => {
|
||||
warn!(
|
||||
target: "pow",
|
||||
target: LOG_TARGET,
|
||||
"Unable to propose new block for authoring. \
|
||||
Fetch difficulty failed: {}",
|
||||
err,
|
||||
@@ -577,7 +579,7 @@ where
|
||||
Ok(x) => x,
|
||||
Err(err) => {
|
||||
warn!(
|
||||
target: "pow",
|
||||
target: LOG_TARGET,
|
||||
"Unable to propose new block for authoring. \
|
||||
Creating inherent data providers failed: {}",
|
||||
err,
|
||||
@@ -590,7 +592,7 @@ where
|
||||
Ok(r) => r,
|
||||
Err(e) => {
|
||||
warn!(
|
||||
target: "pow",
|
||||
target: LOG_TARGET,
|
||||
"Unable to propose new block for authoring. \
|
||||
Creating inherent data failed: {}",
|
||||
e,
|
||||
@@ -610,7 +612,7 @@ where
|
||||
Ok(x) => x,
|
||||
Err(err) => {
|
||||
warn!(
|
||||
target: "pow",
|
||||
target: LOG_TARGET,
|
||||
"Unable to propose new block for authoring. \
|
||||
Creating proposer failed: {:?}",
|
||||
err,
|
||||
@@ -624,7 +626,7 @@ where
|
||||
Ok(x) => x,
|
||||
Err(err) => {
|
||||
warn!(
|
||||
target: "pow",
|
||||
target: LOG_TARGET,
|
||||
"Unable to propose new block for authoring. \
|
||||
Creating proposal failed: {}",
|
||||
err,
|
||||
@@ -654,14 +656,14 @@ where
|
||||
fn find_pre_digest<B: BlockT>(header: &B::Header) -> Result<Option<Vec<u8>>, Error<B>> {
|
||||
let mut pre_digest: Option<_> = None;
|
||||
for log in header.digest().logs() {
|
||||
trace!(target: "pow", "Checking log {:?}, looking for pre runtime digest", log);
|
||||
trace!(target: LOG_TARGET, "Checking log {:?}, looking for pre runtime digest", log);
|
||||
match (log, pre_digest.is_some()) {
|
||||
(DigestItem::PreRuntime(POW_ENGINE_ID, _), true) =>
|
||||
return Err(Error::MultiplePreRuntimeDigests),
|
||||
(DigestItem::PreRuntime(POW_ENGINE_ID, v), false) => {
|
||||
pre_digest = Some(v.clone());
|
||||
},
|
||||
(_, _) => trace!(target: "pow", "Ignoring digest not meant for us"),
|
||||
(_, _) => trace!(target: LOG_TARGET, "Ignoring digest not meant for us"),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ use std::{
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
use crate::{PowAlgorithm, PowIntermediate, Seal, INTERMEDIATE_KEY, POW_ENGINE_ID};
|
||||
use crate::{PowAlgorithm, PowIntermediate, Seal, INTERMEDIATE_KEY, LOG_TARGET, POW_ENGINE_ID};
|
||||
|
||||
/// Mining metadata. This is the information needed to start an actual mining loop.
|
||||
#[derive(Clone, Eq, PartialEq)]
|
||||
@@ -159,26 +159,16 @@ where
|
||||
) {
|
||||
Ok(true) => (),
|
||||
Ok(false) => {
|
||||
warn!(
|
||||
target: "pow",
|
||||
"Unable to import mined block: seal is invalid",
|
||||
);
|
||||
warn!(target: LOG_TARGET, "Unable to import mined block: seal is invalid",);
|
||||
return false
|
||||
},
|
||||
Err(err) => {
|
||||
warn!(
|
||||
target: "pow",
|
||||
"Unable to import mined block: {}",
|
||||
err,
|
||||
);
|
||||
warn!(target: LOG_TARGET, "Unable to import mined block: {}", err,);
|
||||
return false
|
||||
},
|
||||
}
|
||||
} else {
|
||||
warn!(
|
||||
target: "pow",
|
||||
"Unable to import mined block: metadata does not exist",
|
||||
);
|
||||
warn!(target: LOG_TARGET, "Unable to import mined block: metadata does not exist",);
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -192,10 +182,7 @@ where
|
||||
} {
|
||||
build
|
||||
} else {
|
||||
warn!(
|
||||
target: "pow",
|
||||
"Unable to import mined block: build does not exist",
|
||||
);
|
||||
warn!(target: LOG_TARGET, "Unable to import mined block: build does not exist",);
|
||||
return false
|
||||
};
|
||||
|
||||
@@ -225,18 +212,13 @@ where
|
||||
);
|
||||
|
||||
info!(
|
||||
target: "pow",
|
||||
"✅ Successfully mined block on top of: {}",
|
||||
build.metadata.best_hash
|
||||
target: LOG_TARGET,
|
||||
"✅ Successfully mined block on top of: {}", build.metadata.best_hash
|
||||
);
|
||||
true
|
||||
},
|
||||
Err(err) => {
|
||||
warn!(
|
||||
target: "pow",
|
||||
"Unable to import mined block: {}",
|
||||
err,
|
||||
);
|
||||
warn!(target: LOG_TARGET, "Unable to import mined block: {}", err,);
|
||||
false
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user