diff --git a/subxt/src/backend/unstable/mod.rs b/subxt/src/backend/unstable/mod.rs index 9e6f440fc0..34e2fc9b4f 100644 --- a/subxt/src/backend/unstable/mod.rs +++ b/subxt/src/backend/unstable/mod.rs @@ -441,6 +441,7 @@ impl Backend for UnstableBackend { enum SeenBlock { New((Ref, Ref)), Finalized(Vec), + Other(OtherEvent), } #[derive(Debug)] enum SeenBlockMarker { @@ -448,6 +449,19 @@ impl Backend for UnstableBackend { Finalized, } + #[derive(Debug)] + enum OtherEvent { + BestBlockChanged, + OperationBodyDone, + OperationCallDone, + OperationStorageItems, + OperationWaitingForContinue, + OperationStorageDone, + OperationInaccessible, + OperationError, + Stop, + } + static mut FIN_BLOCK: Option = None; unsafe { FIN_BLOCK = None }; @@ -475,10 +489,33 @@ impl Backend for UnstableBackend { unsafe { PRUNED = Some(format!(" pruned {:?} {:?}", PRUNED, ev.pruned_block_hashes)); } - Some(SeenBlock::Finalized(ev.finalized_block_hashes)) } - _ => None, + FollowEvent::BestBlockChanged(_) => { + Some(SeenBlock::Other(OtherEvent::BestBlockChanged)) + } + FollowEvent::OperationBodyDone(_) => { + Some(SeenBlock::Other(OtherEvent::OperationBodyDone)) + } + FollowEvent::OperationCallDone(_) => { + Some(SeenBlock::Other(OtherEvent::OperationCallDone)) + } + FollowEvent::OperationStorageItems(_) => { + Some(SeenBlock::Other(OtherEvent::OperationStorageItems)) + } + FollowEvent::OperationWaitingForContinue(_) => { + Some(SeenBlock::Other(OtherEvent::OperationWaitingForContinue)) + } + FollowEvent::OperationStorageDone(_) => { + Some(SeenBlock::Other(OtherEvent::OperationStorageDone)) + } + FollowEvent::OperationInaccessible(_) => { + Some(SeenBlock::Other(OtherEvent::OperationInaccessible)) + } + FollowEvent::OperationError(_) => { + Some(SeenBlock::Other(OtherEvent::OperationError)) + } + FollowEvent::Stop => Some(SeenBlock::Other(OtherEvent::Stop)), }) }); @@ -489,6 +526,7 @@ impl Backend for UnstableBackend { .await?; let mut seen_blocks = HashMap::new(); + let mut seen_other = Vec::new(); let mut done = false; // If we see the finalized event, we start waiting until we find a finalized block that @@ -507,8 +545,9 @@ impl Backend for UnstableBackend { println!("Pruned block {:?}", unsafe { &PRUNED }); println!("MemLog: {:#?}", mem_log); println!("SeenBlocksLog: {:#?}", seen_blocks); + println!("SeenOther: {:#?}", seen_other); - panic!("{:#?} {:#?}", mem_log, seen_blocks); + panic!("{:#?} {:#?} {:#?}", mem_log, seen_blocks, seen_other); } // Bail early if no more tx events; we don't want to keep polling for pinned blocks. @@ -552,6 +591,9 @@ impl Backend for UnstableBackend { // .0 = SeenBlockMarker::Finalized; } } + SeenBlock::Other(other) => { + seen_other.push((now.elapsed(), other)); + } } continue; }