connector
This commit is contained in:
parent
ea77d5d658
commit
202b10a8d7
@ -2,7 +2,7 @@ from pybtc import int_to_c_int, c_int_to_int, c_int_len
|
|||||||
import asyncio
|
import asyncio
|
||||||
from collections import OrderedDict, deque
|
from collections import OrderedDict, deque
|
||||||
from lru import LRU
|
from lru import LRU
|
||||||
|
import pickle
|
||||||
|
|
||||||
class UTXO():
|
class UTXO():
|
||||||
def __init__(self, db_pool, loop, log, cache_size):
|
def __init__(self, db_pool, loop, log, cache_size):
|
||||||
@ -34,7 +34,7 @@ class UTXO():
|
|||||||
self.outs_total = 0
|
self.outs_total = 0
|
||||||
|
|
||||||
def set(self, outpoint, pointer, amount, address):
|
def set(self, outpoint, pointer, amount, address):
|
||||||
self.cached[outpoint] = (pointer, amount, address)
|
self.cached[outpoint] = pickle.dumps(pointer, amount, address)
|
||||||
self.outs_total += 1
|
self.outs_total += 1
|
||||||
if pointer:
|
if pointer:
|
||||||
self.last_cached_block = pointer >> 42
|
self.last_cached_block = pointer >> 42
|
||||||
@ -147,7 +147,7 @@ class UTXO():
|
|||||||
def get(self, key, block_height):
|
def get(self, key, block_height):
|
||||||
self._requests += 1
|
self._requests += 1
|
||||||
try:
|
try:
|
||||||
i = self.cached[key]
|
i = pickle.loads(self.cached[key])
|
||||||
self.destroyed.append(key)
|
self.destroyed.append(key)
|
||||||
# try:
|
# try:
|
||||||
# self.destroyed[block_height].add(key)
|
# self.destroyed[block_height].add(key)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user