work on torgossip

This commit is contained in:
Kevin Froman 2021-02-04 05:21:37 +00:00
parent 9d546432f5
commit b4127c9836
2 changed files with 10 additions and 4 deletions

View File

@ -65,11 +65,12 @@ def torgossip_runtest(test_manager):
s.sendall(b'5' + bl_new.id) s.sendall(b'5' + bl_new.id)
assert s.recv(64) == bl_new.get_packed() assert s.recv(64) == bl_new.get_packed()
s.sendall(b'41tst') s.sendall(b'40,tbt')
assert s.recv(1000) == tsts[64:] assert len(s.recv(100000)) == len(shared_state.get_by_string("SafeDB").get('bl-tbt'))
s.sendall(b'42tst') s.sendall(b'41,tbt')
assert s.recv(1000) == tsts[64*2:] assert len(s.recv(100000)) == len(
shared_state.get_by_string("SafeDB").get('bl-tbt')) - 64
# test peer list # test peer list
#fake_peer = _fake_onion() #fake_peer = _fake_onion()

View File

@ -73,6 +73,11 @@ def start_server(shared_state):
conn.sendall( conn.sendall(
commandhandlers.list_blocks_by_type( commandhandlers.list_blocks_by_type(
shared_state.get_by_string('SafeDB'), data)) 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: elif cmd == GossipCommands.CHECK_HAS_BLOCK:
conn.sendall( conn.sendall(
commandhandlers.handle_check_block( commandhandlers.handle_check_block(