Can I keep listening to channel events until the stop block generated?
Macc679 opened this issue · 1 comments
Macc679 commented
If the current block height is 10000, here is my code
async def get_filter_block_events(org, peer, channel, stop_height):
org_user = client.get_user(org, "User1")
channel = client.get_channel(channel)
peer_info = client.get_peer(peer)
channel_event_hub = channel.newChannelEventHub(peer_info, org_user)
channel_event_hub.registerBlockEvent(unregister=False, start=height, stop=stop_height, onEvent=onFilteredEvent)
stream = channel_event_hub.connect(filtered=True)
await stream
def test_event():
org = 'org1'
peer = 'peer1.org1'
loop = asyncio.get_event_loop()
loop.run_until_complete(main(org, peer, channel, 10010))
the stop block is 10010, but the program is not going to wait, it will stop when there is no block.
How can I make the program to keep waiting until reach block 10010?
Macc679 commented
I added the outer listening loop and the problem was solved