@@ -0,0 +1,1438 @@
+import asyncio%0A%0Aimport pytest%0A%0Afrom electrumx.server.controller import Notifications%0A%0A%0A@pytest.mark.asyncio%0Aasync def test_simple_mempool():%0A    n = Notifications()%0A    notified = %5B%5D%0A    async def notify(height, touched):%0A        notified.append((height, touched))%0A    await n.start(5, notify)%0A%0A    mtouched = %7B'a', 'b'%7D%0A    btouched = %7B'b', 'c'%7D%0A    await n.on_mempool(mtouched, 6)%0A    assert notified == %5B(5, set())%5D%0A    await n.on_block(btouched, 6)%0A    assert notified == %5B(5, set()), (6, set.union(mtouched, btouched))%5D%0A%0A%0A@pytest.mark.asyncio%0Aasync def test_enter_mempool_quick_blocks_2():%0A    n = Notifications()%0A    notified = %5B%5D%0A    async def notify(height, touched):%0A        notified.append((height, touched))%0A    await n.start(5, notify)%0A%0A    # Suppose a gets in block 6 and blocks 7,8 found right after and%0A    # the block processer processes them together.%0A    await n.on_mempool(%7B'a'%7D, 5)%0A    assert notified == %5B(5, set()), (5, %7B'a'%7D)%5D%0A    # Mempool refreshes with daemon on block 6%0A    await n.on_mempool(%7B'a'%7D, 6)%0A    assert notified == %5B(5, set()), (5, %7B'a'%7D)%5D%0A    # Blocks 6, 7 processed together%0A    await n.on_block(%7B'a', 'b'%7D, 7)%0A    assert notified == %5B(5, set()), (5, %7B'a'%7D)%5D%0A    # Then block 8 processed%0A    await n.on_block(%7B'c'%7D, 8)%0A    assert notified == %5B(5, set()), (5, %7B'a'%7D)%5D%0A    # Now mempool refreshes%0A    await n.on_mempool(set(), 8)%0A    assert notified == %5B(5, set()), (5, %7B'a'%7D), (8, %7B'a', 'b', 'c'%7D)%5D%0A

Add testcase for prior