Skip to content
This repository was archived by the owner on May 16, 2019. It is now read-only.

Commit 567850b

Browse files
committed
Fix signing dispute resolution
1 parent 3d3ce52 commit 567850b

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

market/moderation.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def close_dispute(resolution_json, db, message_listener, notification_listener,
143143
order_id = resolution_json["dispute_resolution"]["resolution"]["order_id"]
144144

145145
if os.path.exists(DATA_FOLDER + "purchases/in progress/" + order_id + ".json"):
146-
file_path = DATA_FOLDER + "purchases/trade receipts/" + order_id + ".json"
146+
file_path = DATA_FOLDER + "purchases/in progress/" + order_id + ".json"
147147
elif os.path.exists(DATA_FOLDER + "store/contracts/in progress/" + order_id + ".json"):
148148
file_path = DATA_FOLDER + "store/contracts/in progress/" + order_id + ".json"
149149

@@ -157,9 +157,11 @@ def close_dispute(resolution_json, db, message_listener, notification_listener,
157157
moderator_pubkey = unhexlify(moderator["pubkeys"]["guid"])
158158
moderator_avatar = unhexlify(moderator["avatar"])
159159

160+
print json.dumps(resolution_json, indent=4)
161+
160162
verify_key = nacl.signing.VerifyKey(moderator_pubkey)
161163
verify_key.verify(json.dumps(resolution_json["dispute_resolution"]["resolution"], indent=4),
162-
resolution_json["dispute_resolution"]["signature"])
164+
base64.b64decode(resolution_json["dispute_resolution"]["signature"]))
163165

164166
contract["dispute_resolution"] = resolution_json["dispute_resolution"]
165167

market/network.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ def history_fetched(ec, history):
854854
dispute_json["dispute_resolution"]["resolution"]["decision"] = resolution
855855
dispute_json["dispute_resolution"]["signature"] = \
856856
base64.b64encode(KeyChain(self.db).signing_key.sign(json.dumps(
857-
dispute_json["dispute_resolution"]["resolution"]))[:64])
857+
dispute_json["dispute_resolution"]["resolution"], indent=4))[:64])
858858

859859
def get_node(node_to_ask, recipient_guid, public_key):
860860
def parse_response(response):

market/protocol.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,9 @@ def rpc_dispute_open(self, sender, pubkey, encrypted):
316316
def rpc_dispute_close(self, sender, pubkey, encrypted):
317317
try:
318318
box = Box(self.signing_key.to_curve25519_private_key(), PublicKey(pubkey))
319-
order = box.decrypt(encrypted)
320-
contract = json.loads(order, object_pairs_hook=OrderedDict)
321-
close_dispute(contract, self.db, self.get_message_listener(),
319+
res = box.decrypt(encrypted)
320+
resolution_json = json.loads(res, object_pairs_hook=OrderedDict)
321+
close_dispute(resolution_json, self.db, self.get_message_listener(),
322322
self.get_notification_listener(), self.multiplexer.testnet)
323323
self.router.addContact(sender)
324324
self.log.info("Contract dispute closed by %s" % sender)

0 commit comments

Comments
 (0)