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

Commit f2b47e1

Browse files
committed
Fix bug serializing outpoint
1 parent 6e025f2 commit f2b47e1

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

market/network.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
import os.path
1414
import pickle
1515
import time
16+
import struct
1617
from binascii import unhexlify
17-
from bitcoin.core import COutPoint, lx
18+
from bitcoin.core import b2lx
1819
from collections import OrderedDict
1920
from config import DATA_FOLDER, TRANSACTION_FEE
2021
from dht.node import Node
@@ -990,7 +991,8 @@ def release_funds(self, order_id):
990991
for s in contract["dispute_resolution"]["resolution"]["tx_signatures"]:
991992
if "outpoint" in s:
992993
for outpoint in outpoints:
993-
if COutPoint(lx(outpoint["txid"]), outpoint["vout"]).encode("hex") == s["outpoint"]:
994+
ser = outpoint["txid"] + b2lx(struct.pack(b"<I", outpoint["vout"]))
995+
if ser == s["outpoint"]:
994996
o.append(outpoint)
995997
if len(o) != 0:
996998
outpoints = o

market/transactions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def create_signature(self, privkey, reedem_script):
9898
signatures.append({
9999
"index": i,
100100
"signature": (seckey.sign(sighash) + struct.pack('<B', SIGHASH_ALL)).encode("hex"),
101-
"outpoint": self.tx.vin[i].prevout.encode("hex")
101+
"outpoint": b2lx(self.tx.vin[i].prevout.hash) + b2lx(struct.pack(b"<I", self.tx.vin[i].prevout.n))
102102
})
103103
return signatures
104104

0 commit comments

Comments
 (0)