From 467c9c146daf6e4ccbd118c584b16af8506d5425 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Wed, 27 Nov 2019 13:28:13 +0300 Subject: [PATCH] core: restore intermediate block-level store Commit c80ee952a1a8a5a971cf2579d0985ee091cc39a5 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). --- pkg/core/blockchain_state.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/core/blockchain_state.go b/pkg/core/blockchain_state.go index b2f868013..db13408f8 100644 --- a/pkg/core/blockchain_state.go +++ b/pkg/core/blockchain_state.go @@ -19,8 +19,9 @@ type BlockChainState struct { // NewBlockChainState creates blockchain state with it's memchached store. func NewBlockChainState(store *storage.MemCachedStore) *BlockChainState { + tmpStore := storage.NewMemCachedStore(store) return &BlockChainState{ - store: store, + store: tmpStore, unspentCoins: make(UnspentCoins), spentCoins: make(SpentCoins), accounts: make(Accounts),