From 4c1f24da820ba23ba057cd9f3b8155c7c7a87aa1 Mon Sep 17 00:00:00 2001 From: Svarog Date: Wed, 21 Oct 2020 10:19:41 +0300 Subject: [PATCH] [NOD-1466] Move UTXODiffStore from ConsensusStateManager to UTXODiffManager (#961) --- domain/consensus/factory.go | 3 +-- .../consensusstatemanager/consensusstatemanager.go | 3 --- .../consensus/processes/utxodiffmanager/utxodiffmanager.go | 7 +++++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/domain/consensus/factory.go b/domain/consensus/factory.go index 483b07f06..3e636b006 100644 --- a/domain/consensus/factory.go +++ b/domain/consensus/factory.go @@ -69,14 +69,13 @@ func (f *factory) NewConsensus(dagParams *dagconfig.Params, databaseContext *dba dagTraversalManager := dagtraversalmanager.New( dagTopologyManager, ghostdagManager) - utxoDiffManager := utxodiffmanager.New() + utxoDiffManager := utxodiffmanager.New(utxoDiffStore) acceptanceManager := acceptancemanager.New(utxoDiffManager) consensusStateManager := consensusstatemanager.New( domainDBContext, dagParams, consensusStateStore, multisetStore, - utxoDiffStore, blockStore, ghostdagManager, acceptanceManager) diff --git a/domain/consensus/processes/consensusstatemanager/consensusstatemanager.go b/domain/consensus/processes/consensusstatemanager/consensusstatemanager.go index 452d7a45c..54476997e 100644 --- a/domain/consensus/processes/consensusstatemanager/consensusstatemanager.go +++ b/domain/consensus/processes/consensusstatemanager/consensusstatemanager.go @@ -14,7 +14,6 @@ type consensusStateManager struct { databaseContext *database.DomainDBContext consensusStateStore model.ConsensusStateStore multisetStore model.MultisetStore - utxoDiffStore model.UTXODiffStore blockStore model.BlockStore ghostdagManager model.GHOSTDAGManager acceptanceManager model.AcceptanceManager @@ -26,7 +25,6 @@ func New( dagParams *dagconfig.Params, consensusStateStore model.ConsensusStateStore, multisetStore model.MultisetStore, - utxoDiffStore model.UTXODiffStore, blockStore model.BlockStore, ghostdagManager model.GHOSTDAGManager, acceptanceManager model.AcceptanceManager) model.ConsensusStateManager { @@ -37,7 +35,6 @@ func New( databaseContext: databaseContext, consensusStateStore: consensusStateStore, multisetStore: multisetStore, - utxoDiffStore: utxoDiffStore, blockStore: blockStore, ghostdagManager: ghostdagManager, acceptanceManager: acceptanceManager, diff --git a/domain/consensus/processes/utxodiffmanager/utxodiffmanager.go b/domain/consensus/processes/utxodiffmanager/utxodiffmanager.go index 705ca0cd6..909fb30c4 100644 --- a/domain/consensus/processes/utxodiffmanager/utxodiffmanager.go +++ b/domain/consensus/processes/utxodiffmanager/utxodiffmanager.go @@ -8,11 +8,14 @@ import ( // UTXODiffManager provides methods to access // and store UTXO diffs type utxoDiffManager struct { + utxoDiffStore model.UTXODiffStore } // New instantiates a new UTXODiffManager -func New() model.UTXODiffManager { - return &utxoDiffManager{} +func New(utxoDiffStore model.UTXODiffStore) model.UTXODiffManager { + return &utxoDiffManager{ + utxoDiffStore: utxoDiffStore, + } } // StoreUTXODiff stores the given utxoDiff for the given blockHash