From 2a5ac613f47f7469d3521e199119a1c34c3f7359 Mon Sep 17 00:00:00 2001 From: Alexandru Vasile Date: Tue, 16 Jan 2024 11:51:07 +0200 Subject: [PATCH] backend/tests: Ensure new blocks are not unpinned Signed-off-by: Alexandru Vasile --- subxt/src/backend/unstable/follow_stream_unpin.rs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/subxt/src/backend/unstable/follow_stream_unpin.rs b/subxt/src/backend/unstable/follow_stream_unpin.rs index 1820b3423a..d4e9e7c431 100644 --- a/subxt/src/backend/unstable/follow_stream_unpin.rs +++ b/subxt/src/backend/unstable/follow_stream_unpin.rs @@ -564,8 +564,8 @@ mod test { } #[tokio::test] - async fn unpins_dropped_blocks() { - let (mut follow_unpin, unpin_rx) = test_unpin_stream_getter( + async fn dropped_new_blocks_should_not_get_unpinned() { + let (mut follow_unpin, _) = test_unpin_stream_getter( || { [ Ok(ev_initialized(0)), @@ -581,19 +581,13 @@ mod test { let _i0 = follow_unpin.next().await.unwrap().unwrap(); let f1 = follow_unpin.next().await.unwrap().unwrap(); - // We don't care about block 1 any more; drop it. unpins happen at finalized evs. + // We don't care about block 1 any more; drop it. unpinning happens when the max_life is exceeded. drop(f1); let _f2 = follow_unpin.next().await.unwrap().unwrap(); - // Check that we get the expected unpin event. - let (hash, _) = unpin_rx - .try_recv() - .expect("unpin call should have happened"); - assert_eq!(hash, H256::from_low_u64_le(1)); - // Confirm that 0 and 2 are still pinned and that 1 isnt. - assert!(!follow_unpin.is_pinned(&H256::from_low_u64_le(1))); + assert!(follow_unpin.is_pinned(&H256::from_low_u64_le(1))); assert!(follow_unpin.is_pinned(&H256::from_low_u64_le(0))); assert!(follow_unpin.is_pinned(&H256::from_low_u64_le(2))); }