core: restore intermediate block-level store

Commit c80ee952a1 removed temporary store used
to contain changes of the block being processed. It's wrong in that the block
changes should be applied to the database in a single transaction so that
there wouldn't be any intermediate state observed from the outside (which is
possible now). Also, this made changes commiting persist them to the
underlying store effectively making our persist loop a no-op (and not
producing `persist completed` log lines that we love so much).
This commit is contained in:
Roman Khimov 2019-11-27 13:28:13 +03:00
parent bb765ccfa7
commit 467c9c146d

View file

@ -19,8 +19,9 @@ type BlockChainState struct {
// NewBlockChainState creates blockchain state with it's memchached store. // NewBlockChainState creates blockchain state with it's memchached store.
func NewBlockChainState(store *storage.MemCachedStore) *BlockChainState { func NewBlockChainState(store *storage.MemCachedStore) *BlockChainState {
tmpStore := storage.NewMemCachedStore(store)
return &BlockChainState{ return &BlockChainState{
store: store, store: tmpStore,
unspentCoins: make(UnspentCoins), unspentCoins: make(UnspentCoins),
spentCoins: make(SpentCoins), spentCoins: make(SpentCoins),
accounts: make(Accounts), accounts: make(Accounts),