mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 19:51:05 +00:00
backend: Extra debug
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
@@ -477,12 +477,18 @@ impl<T: Config + Send + Sync + 'static> Backend<T> for UnstableBackend<T> {
|
|||||||
let mut iter_num = 0;
|
let mut iter_num = 0;
|
||||||
let now = std::time::Instant::now();
|
let now = std::time::Instant::now();
|
||||||
|
|
||||||
|
let mut tx_logs = Vec::with_capacity(32);
|
||||||
|
let mut chainhead_logs = Vec::with_capacity(32);
|
||||||
|
|
||||||
// Now we can attempt to associate tx events with pinned blocks.
|
// Now we can attempt to associate tx events with pinned blocks.
|
||||||
let tx_stream = futures::stream::poll_fn(move |cx| {
|
let tx_stream = futures::stream::poll_fn(move |cx| {
|
||||||
loop {
|
loop {
|
||||||
iter_num += 1;
|
iter_num += 1;
|
||||||
if now.elapsed().as_secs() > 120 {
|
if now.elapsed().as_secs() > 120 {
|
||||||
panic!("iter={:#?}", iter_num);
|
panic!(
|
||||||
|
"iter_num: {}, tx_logs: {:#?}, chainhead_logs: {:#?}",
|
||||||
|
iter_num, tx_logs, chainhead_logs
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bail early if no more tx events; we don't want to keep polling for pinned blocks.
|
// Bail early if no more tx events; we don't want to keep polling for pinned blocks.
|
||||||
@@ -494,6 +500,8 @@ impl<T: Config + Send + Sync + 'static> Backend<T> for UnstableBackend<T> {
|
|||||||
if let Poll::Ready(Some(seen_block)) = seen_blocks_sub.poll_next_unpin(cx) {
|
if let Poll::Ready(Some(seen_block)) = seen_blocks_sub.poll_next_unpin(cx) {
|
||||||
match seen_block {
|
match seen_block {
|
||||||
SeenBlock::New(block_ref) => {
|
SeenBlock::New(block_ref) => {
|
||||||
|
chainhead_logs.push((now.elapsed().as_secs(), "new", block_ref.hash()));
|
||||||
|
|
||||||
// Optimization: once we have a `finalized_hash`, we only care about finalized
|
// Optimization: once we have a `finalized_hash`, we only care about finalized
|
||||||
// block refs now and can avoid bothering to save new blocks.
|
// block refs now and can avoid bothering to save new blocks.
|
||||||
if finalized_hash.is_none() {
|
if finalized_hash.is_none() {
|
||||||
@@ -503,6 +511,12 @@ impl<T: Config + Send + Sync + 'static> Backend<T> for UnstableBackend<T> {
|
|||||||
}
|
}
|
||||||
SeenBlock::Finalized(block_refs) => {
|
SeenBlock::Finalized(block_refs) => {
|
||||||
for block_ref in block_refs {
|
for block_ref in block_refs {
|
||||||
|
chainhead_logs.push((
|
||||||
|
now.elapsed().as_secs(),
|
||||||
|
"finalized",
|
||||||
|
block_ref.hash(),
|
||||||
|
));
|
||||||
|
|
||||||
seen_blocks.insert(
|
seen_blocks.insert(
|
||||||
block_ref.hash(),
|
block_ref.hash(),
|
||||||
(SeenBlockMarker::Finalized, block_ref),
|
(SeenBlockMarker::Finalized, block_ref),
|
||||||
@@ -543,6 +557,8 @@ impl<T: Config + Send + Sync + 'static> Backend<T> for UnstableBackend<T> {
|
|||||||
Poll::Ready(Some(Ok(ev))) => ev,
|
Poll::Ready(Some(Ok(ev))) => ev,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
tx_logs.push((now.elapsed().as_secs(), ev.clone()));
|
||||||
|
|
||||||
// When we get one, map it to the correct format (or for finalized ev, wait for the pinned block):
|
// When we get one, map it to the correct format (or for finalized ev, wait for the pinned block):
|
||||||
let ev = match ev {
|
let ev = match ev {
|
||||||
rpc_methods::TransactionStatus::Finalized { block } => {
|
rpc_methods::TransactionStatus::Finalized { block } => {
|
||||||
|
|||||||
Reference in New Issue
Block a user