mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-04-10 22:41:53 +08:00
backport compatibility with virtualchain 0.0.8
This commit is contained in:
@@ -39,9 +39,9 @@ from ..config import NAMESPACE_DEFAULT, MIN_OP_LENGTHS, OPCODES, MAX_NAMES_PER_S
|
||||
NAMESPACE_PREORDER_EXPIRE, NAMESPACE_REVEAL_EXPIRE, NAMESPACE_REVEAL, BLOCKSTORE_VERSION, \
|
||||
NAMESPACE_1_CHAR_COST, NAMESPACE_23_CHAR_COST, NAMESPACE_4567_CHAR_COST, NAMESPACE_8UP_CHAR_COST, NAME_COST_UNIT, \
|
||||
TESTSET_NAMESPACE_1_CHAR_COST, TESTSET_NAMESPACE_23_CHAR_COST, TESTSET_NAMESPACE_4567_CHAR_COST, TESTSET_NAMESPACE_8UP_CHAR_COST, NAME_COST_UNIT, \
|
||||
NAME_IMPORT_KEYRING_SIZE, GENESIS_SNAPSHOT, GENESIS_SNAPSHOT_TESTSET, default_blockstack_opts, NAMESPACE_READY
|
||||
NAME_IMPORT_KEYRING_SIZE, GENESIS_SNAPSHOT, GENESIS_SNAPSHOT_TESTSET, default_blockstack_opts, NAMESPACE_READY, NAME_OPCODES
|
||||
|
||||
from ..operations import build_namespace_reveal
|
||||
from ..operations import build_namespace_reveal, SERIALIZE_FIELDS
|
||||
from ..hashing import *
|
||||
from ..b40 import is_b40
|
||||
|
||||
@@ -81,7 +81,7 @@ class BlockstackDB( virtualchain.StateEngine ):
|
||||
initial_snapshots = GENESIS_SNAPSHOT
|
||||
|
||||
|
||||
super( BlockstackDB, self ).__init__( virtualchain_hooks.get_magic_bytes(), OPCODES, impl=virtualchain_hooks, initial_snapshots=initial_snapshots, state=self )
|
||||
super( BlockstackDB, self ).__init__( virtualchain_hooks.get_magic_bytes(), OPCODES, BlockstackDB.make_opfields(), impl=virtualchain_hooks, initial_snapshots=initial_snapshots, state=self )
|
||||
|
||||
self.announce_ids = blockstack_opts['announcers'].split(",")
|
||||
|
||||
@@ -231,6 +231,20 @@ class BlockstackDB( virtualchain.StateEngine ):
|
||||
self.prescanned = False
|
||||
|
||||
|
||||
@classmethod
|
||||
def make_opfields( cls ):
|
||||
"""
|
||||
Calculate the virtulachain-required opfields dict.
|
||||
"""
|
||||
# construct fields
|
||||
opfields = {}
|
||||
for opname in SERIALIZE_FIELDS.keys():
|
||||
opcode = NAME_OPCODES[opname]
|
||||
opfields[opcode] = SERIALIZE_FIELDS[opname]
|
||||
|
||||
return opfields
|
||||
|
||||
|
||||
def save_db(self, filename):
|
||||
"""
|
||||
Cache the set of blockstack operations to disk,
|
||||
|
||||
Reference in New Issue
Block a user