Skip to content
This repository has been archived by the owner on Nov 15, 2021. It is now read-only.

Commit

Permalink
Preparation to support different database backends (#939)
Browse files Browse the repository at this point in the history
  • Loading branch information
merl111 authored and ixje committed Jun 12, 2019
1 parent a90947f commit 00b3860
Show file tree
Hide file tree
Showing 49 changed files with 1,914 additions and 1,395 deletions.
16 changes: 8 additions & 8 deletions neo/Blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ def GetSystemShare():

def GetStateMachine():
from neo.SmartContract.StateMachine import StateMachine
from neo.Implementations.Blockchains.LevelDB.DBCollection import DBCollection
from neo.Implementations.Blockchains.LevelDB.DBPrefix import DBPrefix
from neo.Storage.Interface.DBInterface import DBInterface
from neo.Storage.Common.DBPrefix import DBPrefix
from neo.Core.State.AccountState import AccountState
from neo.Core.State.AssetState import AssetState
from neo.Core.State.ValidatorState import ValidatorState
Expand All @@ -30,13 +30,13 @@ def GetStateMachine():

bc = GetBlockchain()

accounts = DBCollection(bc._db, DBPrefix.ST_Account, AccountState)
assets = DBCollection(bc._db, DBPrefix.ST_Asset, AssetState)
validators = DBCollection(bc._db, DBPrefix.ST_Validator, ValidatorState)
contracts = DBCollection(bc._db, DBPrefix.ST_Contract, ContractState)
storages = DBCollection(bc._db, DBPrefix.ST_Storage, StorageItem)
accounts = DBInterface(bc._db, DBPrefix.ST_Account, AccountState)
assets = DBInterface(bc._db, DBPrefix.ST_Asset, AssetState)
validators = DBInterface(bc._db, DBPrefix.ST_Validator, ValidatorState)
contracts = DBInterface(bc._db, DBPrefix.ST_Contract, ContractState)
storages = DBInterface(bc._db, DBPrefix.ST_Storage, StorageItem)

return StateMachine(accounts, validators, assets, contracts, storages, None)
return StateMachine(accounts, validators, assets, contracts, storages, None, bc)


def GetConsensusAddress(validators):
Expand Down
Loading

0 comments on commit 00b3860

Please sign in to comment.