@@ -477,12 +477,18 @@ impl<T: Config + Send + Sync + 'static> Backend<T> for UnstableBackend<T> {
477
477
let mut iter_num = 0 ;
478
478
let now = std:: time:: Instant :: now ( ) ;
479
479
480
+ let mut tx_logs = Vec :: with_capacity ( 32 ) ;
481
+ let mut chainhead_logs = Vec :: with_capacity ( 32 ) ;
482
+
480
483
// Now we can attempt to associate tx events with pinned blocks.
481
484
let tx_stream = futures:: stream:: poll_fn ( move |cx| {
482
485
loop {
483
486
iter_num += 1 ;
484
487
if now. elapsed ( ) . as_secs ( ) > 120 {
485
- panic ! ( "iter={:#?}" , iter_num) ;
488
+ panic ! (
489
+ "iter_num: {}, tx_logs: {:#?}, chainhead_logs: {:#?}" ,
490
+ iter_num, tx_logs, chainhead_logs
491
+ ) ;
486
492
}
487
493
488
494
// 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> {
494
500
if let Poll :: Ready ( Some ( seen_block) ) = seen_blocks_sub. poll_next_unpin ( cx) {
495
501
match seen_block {
496
502
SeenBlock :: New ( block_ref) => {
503
+ chainhead_logs. push ( ( now. elapsed ( ) . as_secs ( ) , "new" , block_ref. hash ( ) ) ) ;
504
+
497
505
// Optimization: once we have a `finalized_hash`, we only care about finalized
498
506
// block refs now and can avoid bothering to save new blocks.
499
507
if finalized_hash. is_none ( ) {
@@ -503,6 +511,12 @@ impl<T: Config + Send + Sync + 'static> Backend<T> for UnstableBackend<T> {
503
511
}
504
512
SeenBlock :: Finalized ( block_refs) => {
505
513
for block_ref in block_refs {
514
+ chainhead_logs. push ( (
515
+ now. elapsed ( ) . as_secs ( ) ,
516
+ "finalized" ,
517
+ block_ref. hash ( ) ,
518
+ ) ) ;
519
+
506
520
seen_blocks. insert (
507
521
block_ref. hash ( ) ,
508
522
( SeenBlockMarker :: Finalized , block_ref) ,
@@ -543,6 +557,8 @@ impl<T: Config + Send + Sync + 'static> Backend<T> for UnstableBackend<T> {
543
557
Poll :: Ready ( Some ( Ok ( ev) ) ) => ev,
544
558
} ;
545
559
560
+ tx_logs. push ( ( now. elapsed ( ) . as_secs ( ) , ev. clone ( ) ) ) ;
561
+
546
562
// When we get one, map it to the correct format (or for finalized ev, wait for the pinned block):
547
563
let ev = match ev {
548
564
rpc_methods:: TransactionStatus :: Finalized { block } => {
0 commit comments