Commit 4ff1bff6 authored by Pascal Engélibert's avatar Pascal Engélibert

Fix ubjson usage

parent f7127010
......@@ -133,7 +133,7 @@ def mix(amount, base, sender, path, host):
if "confirm" in message:
print("This is a confirmation!")
data = bytes.fromhex(message["confirm"])
data = message["confirm"]
try:
data = libnacl.sign.Verifier(PublicKey(path[0]).hex_pk()).verify(data) # Verify
......
......@@ -47,7 +47,7 @@ MIX_INTERVAL = "60"
MIX_MIN_TXS = "5" # minimum amount of txs to mix
MIX_REQ_AGE_MAX = "604800" # maximum mix request age before return to sender
def sendResponse(client, code, resp, dataformat):
def sendResponse(client, code, resp, dataformat="ubjson"):
if dataformat == "ubjson":
content_raw = ubjson.dumpb(resp)
mime = "application/ubjson"
......@@ -391,7 +391,7 @@ class ServerThread(Thread):
continue
message = tx.genMixConfirm(self.keys)
resp["confirm"] = message.hex()
resp["confirm"] = message
tx.need_confirm = False
logPrint("Confirmed "+tx.sender_pubkey[:8]+" -> "+tx.receiver_pubkey[:8]+" = "+str(tx.in_amount)+":"+str(tx.in_base)+" -> "+str(tx.out_amount)+":"+str(tx.out_base), LOG_TRACE)
......@@ -435,7 +435,7 @@ class ServerThread(Thread):
logPrint("Up "+str(peer), LOG_TRACE)
# Send response
sendResponse(client, "200 OK", resp, "ubjson")
sendResponse(client, "200 OK", resp)
self.sock.close()
def stop(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment