mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 22:50:59 +01:00
[qa] Switch to py3
This commit is contained in:
@@ -1,16 +1,17 @@
|
||||
#!/usr/bin/env python3
|
||||
# BlockStore: a helper class that keeps a map of blocks and implements
|
||||
# helper functions for responding to getheaders and getdata,
|
||||
# and for constructing a getheaders message
|
||||
#
|
||||
|
||||
from .mininode import *
|
||||
import dbm
|
||||
from io import BytesIO
|
||||
import dbm.ndbm
|
||||
|
||||
class BlockStore(object):
|
||||
def __init__(self, datadir):
|
||||
self.blockDB = dbm.open(datadir + "/blocks", 'c')
|
||||
self.currentBlock = 0L
|
||||
self.blockDB = dbm.ndbm.open(datadir + "/blocks", 'c')
|
||||
self.currentBlock = 0
|
||||
self.headers_map = dict()
|
||||
|
||||
def close(self):
|
||||
@@ -67,7 +68,7 @@ class BlockStore(object):
|
||||
try:
|
||||
self.blockDB[repr(block.sha256)] = bytes(block.serialize())
|
||||
except TypeError as e:
|
||||
print "Unexpected error: ", sys.exc_info()[0], e.args
|
||||
print("Unexpected error: ", sys.exc_info()[0], e.args)
|
||||
self.currentBlock = block.sha256
|
||||
self.headers_map[block.sha256] = CBlockHeader(block)
|
||||
|
||||
@@ -105,7 +106,7 @@ class BlockStore(object):
|
||||
|
||||
class TxStore(object):
|
||||
def __init__(self, datadir):
|
||||
self.txDB = dbm.open(datadir + "/transactions", 'c')
|
||||
self.txDB = dbm.ndbm.open(datadir + "/transactions", 'c')
|
||||
|
||||
def close(self):
|
||||
self.txDB.close()
|
||||
@@ -127,7 +128,7 @@ class TxStore(object):
|
||||
try:
|
||||
self.txDB[repr(tx.sha256)] = bytes(tx.serialize())
|
||||
except TypeError as e:
|
||||
print "Unexpected error: ", sys.exc_info()[0], e.args
|
||||
print("Unexpected error: ", sys.exc_info()[0], e.args)
|
||||
|
||||
def get_transactions(self, inv):
|
||||
responses = []
|
||||
|
||||
Reference in New Issue
Block a user