connector

This commit is contained in:
4tochka 2019-05-12 21:59:24 +04:00
parent 5e262b8e95
commit 067ae2da8f
3 changed files with 3 additions and 4 deletions

View File

@ -255,7 +255,6 @@ static PyObject *LRU_delete(LRU *self, PyObject *args)
if (!PyArg_ParseTuple(args, "O|O", &key, &instead)) return NULL;
Node *node = GET_NODE(self->dict, key);
PyErr_Clear(); /* GET_NODE sets an exception on miss. Shut it up. */
if (!node) {
if (!instead) { Py_RETURN_NONE; }
Py_INCREF(instead);

View File

@ -245,7 +245,7 @@ class Worker:
inp = block["rawTx"][z]["vIn"][i]
outpoint = b"".join((inp["txId"], int_to_bytes(inp["vOut"])))
try:
r = self.coins[outpoint]
r = self.coins.delete(outpoint)
block["rawTx"][z]["vIn"][i]["_c_"] = r
t += 1
self.destroyed_coins[r[0]] = True
@ -268,7 +268,7 @@ class Worker:
for i in blocks[x]["rawTx"][y]["vOut"]:
try:
pointer = (x << 42) + (y << 21) + i
blocks[x]["rawTx"][y]["vOut"][i]["_s_"] = self.destroyed_coins[pointer]
blocks[x]["rawTx"][y]["vOut"][i]["_s_"] = self.destroyed_coins.delete(pointer)
except: pass
blocks[x] = pickle.dumps(blocks[x])

View File

@ -69,7 +69,7 @@ class UTXO():
if lb != i[1][0] >> 42:
block_changed = True
lb = i[1][0] >> 42
if self.cached <= self.size_limit:
if len(self.cached) <= self.size_limit:
if block_changed:
break
utxo.add((i[0],b"".join((int_to_c_int(i[1][0]),