Commit 1ed196cc authored by Pascal Engélibert's avatar Pascal Engélibert

Fix txs expiration

parent 55579512
......@@ -44,12 +44,10 @@ class Confirmation():
assert data["document"] == "gmixer-mixconfirm1"
self.sender_pubkey = data["sender_pubkey"]
self.in_seeds = data["in_seeds"]
self.in_comment = data["in_comment"]
self.in_amount = data["in_amount"]
self.in_base = data["in_base"]
self.receiver_pubkey = data["receiver_pubkey"]
self.out_seeds = data["out_seeds"]
self.out_comment = data["out_comment"]
self.out_amount = data["out_amount"]
self.out_base = data["out_base"]
......@@ -59,11 +57,9 @@ class Confirmation():
"node_pubkey": self.node_pubkey,
"raw": self.raw,
"sender_pubkey": self.sender_pubkey,
"in_comment": self.in_comment,
"in_amount": self.in_amount,
"in_base": self.in_base,
"receiver_pubkey": self.receiver_pubkey,
"out_comment": self.out_comment,
"out_amount": self.out_amount,
"out_base": self.out_base
}
......
......@@ -87,8 +87,6 @@ class TX:
self.need_confirm = True
self.confirms = b""
self.tx_sent = False
self.in_comment = None
self.out_comment = None
def genMixConfirm(self, keys):
message = {
......@@ -98,12 +96,10 @@ class TX:
"in_amount": self.in_amount,
"in_base": self.in_base,
"in_seeds": self.in_seeds,
"in_comment": self.in_comment,
"receiver_pubkey": self.receiver_pubkey,
"out_amount": self.out_amount,
"out_base": self.out_base,
"out_seeds": self.out_seeds,
"out_comment": self.out_comment,
"req_date": self.date,
"expire_date": self.expire
}
......@@ -135,8 +131,6 @@ class TX:
"need_confirm" : self.need_confirm,
"confirms" : self.confirms,
"tx_sent" : self.tx_sent,
"in_comment": self.in_comment,
"out_comment": self.out_comment,
}))
def import_ubjson(d):
......@@ -147,8 +141,6 @@ class TX:
tx.need_confirm = d["need_confirm"]
tx.confirms = d["confirms"]
tx.tx_sent = d["tx_sent"]
tx.in_comment = d["in_comment"]
tx.out_comment = d["out_comment"]
return tx
def load_txs(db_txs, pool, tx_in_index, tx_out_index):
......@@ -157,6 +149,8 @@ def load_txs(db_txs, pool, tx_in_index, tx_out_index):
pool.append(tx)
tx_in_index[tx.in_seeds[1]] = tx
tx_out_index[tx.out_seeds[1]] = tx
logPrint("Loaded "+str(len(pool))+" txs", LOG_TRACE)
def save_txs(db_txs, pool):
for tx in pool:
......@@ -719,10 +713,12 @@ class ClientThread(Thread):
if tx.date < expire_t:
expire_txs.append(tx)
for tx in expire_txs:
self.tx_in_index.pop(tx.in_comment)
self.tx_out_index.pop(tx.out_comment)
self.db_txs.delete(tx.in_comment.encode())
self.tx_in_index.pop(tx.in_seeds[1])
self.tx_out_index.pop(tx.out_seeds[1])
self.db_txs.delete(tx.in_seeds[2])
self.pool.remove(tx)
if len(expire_txs) > 0:
logPrint("Removed "+str(len(expire_txs))+" expired txs", LOG_TRACE)
time.sleep(5)
......
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