From b4127c98362c538977cbe02cfda5f8cc3933b708 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Thu, 4 Feb 2021 05:21:37 +0000 Subject: [PATCH] work on torgossip --- static-data/default-plugins/torgossip/runtest.py | 9 +++++---- static-data/default-plugins/torgossip/server.py | 5 +++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/static-data/default-plugins/torgossip/runtest.py b/static-data/default-plugins/torgossip/runtest.py index 7062b8ff..3c9ebf1f 100644 --- a/static-data/default-plugins/torgossip/runtest.py +++ b/static-data/default-plugins/torgossip/runtest.py @@ -65,11 +65,12 @@ def torgossip_runtest(test_manager): s.sendall(b'5' + bl_new.id) assert s.recv(64) == bl_new.get_packed() - s.sendall(b'41tst') - assert s.recv(1000) == tsts[64:] + s.sendall(b'40,tbt') + assert len(s.recv(100000)) == len(shared_state.get_by_string("SafeDB").get('bl-tbt')) - s.sendall(b'42tst') - assert s.recv(1000) == tsts[64*2:] + s.sendall(b'41,tbt') + assert len(s.recv(100000)) == len( + shared_state.get_by_string("SafeDB").get('bl-tbt')) - 64 # test peer list #fake_peer = _fake_onion() diff --git a/static-data/default-plugins/torgossip/server.py b/static-data/default-plugins/torgossip/server.py index ba02ef54..82f5e1b7 100644 --- a/static-data/default-plugins/torgossip/server.py +++ b/static-data/default-plugins/torgossip/server.py @@ -73,6 +73,11 @@ def start_server(shared_state): conn.sendall( commandhandlers.list_blocks_by_type( shared_state.get_by_string('SafeDB'), data)) + elif cmd == GossipCommands.LIST_BLOCKS_BY_TYPE_OFFSET: + conn.sendall( + commandhandlers.list_blocks_by_type_and_offset( + shared_state.get_by_string('SafeDB'), data) + ) elif cmd == GossipCommands.CHECK_HAS_BLOCK: conn.sendall( commandhandlers.handle_check_block(