From df78f7ff9fb66c44a2aaa7a3dcd042ac857a0681 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Tue, 20 Feb 2018 13:41:54 -0500 Subject: [PATCH] add response assertion to announce_to_peer --- lbrynet/dht/node.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lbrynet/dht/node.py b/lbrynet/dht/node.py index 1a7985c66..eb595b130 100644 --- a/lbrynet/dht/node.py +++ b/lbrynet/dht/node.py @@ -304,22 +304,22 @@ class Node(object): if not responseMsg.nodeID in known_nodes: log.warning("Responding node was not expected") defer.returnValue(responseMsg.nodeID) - n = known_nodes[responseMsg.nodeID] + remote_node = known_nodes[responseMsg.nodeID] result = responseMsg.response announced = False if 'token' in result: value['token'] = result['token'] try: - res = yield n.store(blob_hash, value, self.node_id) - log.info("Response to store request: %s", str(res)) + res = yield remote_node.store(blob_hash, value) + assert res == "OK", "unexpected response: {}".format(res) announced = True except protocol.TimeoutError: log.info("Timeout while storing blob_hash %s at %s", - blob_hash.encode('hex')[:16], n.id.encode('hex')) + blob_hash.encode('hex')[:16], remote_node.id.encode('hex')) except Exception as err: log.error("Unexpected error while storing blob_hash %s at %s: %s", - blob_hash.encode('hex')[:16], n.id.encode('hex'), err) + blob_hash.encode('hex')[:16], remote_node.id.encode('hex'), err) else: log.warning("missing token") defer.returnValue(announced)