stasatdaglabs 4f36accd81
[NOD-1413] Make some additional interface changes (#954)
* [NOD-1413] Remove /cmd/addblock

* [NOD-1413] Define and implement TransactionValidator.

* [NOD-1413] Make changes to ConsensusStateManager's interface.

* [NOD-1413] Make changes to PruningManager's interface.

* [NOD-1413] Make changes to DAGTraversalManager's interface.

* [NOD-1413] Make changes to MultisetStore's interface.

* [NOD-1413] Make changes to UTXODiffStore's interface.

* [NOD-1413] Make changes to UTXODiffStore's interface harder.

* [NOD-1413] Make changes to AcceptanceDataStore's interface harder.

* [NOD-1413] Make changes to PruningStore's interface.

* [NOD-1413] Delete BlockIndex.

* [NOD-1413] Add FeeDataStore.

* [NOD-1413] Update BlockMessageStore's interface.

* [NOD-1413] Fix interface violations.

* [NOD-1413] Add FeeDataStore to BlockProcessor.

* [NOD-1413] Make go vet happy.

* [NOD-1413] Add missing fields to ConsensusStateChanges.

* [NOD-1413] Add another missing field to ConsensusStateChanges.

* [NOD-1413] Add a reference to blockStore in consensusStateManager.

* [NOD-1413] Add missing methods to UTXODiffStore.

* [NOD-1413] Rename pruningPointStore to pruningStore everywhere.

* [NOD-1413] Remove superfluous parameters from CalculateConsensusStateChanges.

* [NOD-1413] Add missing dependencies to PruningManager.

* [NOD-1413] Remove implementation-y functions from TransactionValidator's interface.

* [NOD-1413] Make go vet happy.

* [NOD-1413] Add a couple of methods to DAGTopologyManager.

* [NOD-1413] Fix a typo in a file name.

* [NOD-1413] Remove non-interface functions from Validator.
2020-10-13 17:55:31 +03:00

69 lines
2.3 KiB
Go

package consensusstatemanager
import (
"github.com/kaspanet/kaspad/domain/consensus/model"
"github.com/kaspanet/kaspad/domain/dagconfig"
)
// ConsensusStateManager manages the node's consensus state
type ConsensusStateManager struct {
dagParams *dagconfig.Params
consensusStateStore model.ConsensusStateStore
multisetStore model.MultisetStore
utxoDiffStore model.UTXODiffStore
blockStore model.BlockStore
}
// New instantiates a new ConsensusStateManager
func New(
dagParams *dagconfig.Params,
consensusStateStore model.ConsensusStateStore,
multisetStore model.MultisetStore,
utxoDiffStore model.UTXODiffStore,
blockStore model.BlockStore) *ConsensusStateManager {
return &ConsensusStateManager{
dagParams: dagParams,
consensusStateStore: consensusStateStore,
multisetStore: multisetStore,
utxoDiffStore: utxoDiffStore,
blockStore: blockStore,
}
}
// UTXOByOutpoint returns a UTXOEntry matching the given outpoint
func (csm *ConsensusStateManager) UTXOByOutpoint(outpoint *model.DomainOutpoint) *model.UTXOEntry {
return nil
}
// CalculateConsensusStateChanges returns a set of changes that must occur in order
// to transition the current consensus state into the one including the given block
func (csm *ConsensusStateManager) CalculateConsensusStateChanges(block *model.DomainBlock, isDisqualified bool) (
stateChanges *model.ConsensusStateChanges, utxoDiffChanges *model.UTXODiffChanges,
virtualGHOSTDAGData *model.BlockGHOSTDAGData) {
return nil, nil, nil
}
// CalculateAcceptanceDataAndMultiset calculates and returns the acceptance data and the
// multiset associated with the given blockHash
func (csm *ConsensusStateManager) CalculateAcceptanceDataAndMultiset(blockHash *model.DomainHash) (*model.BlockAcceptanceData, model.Multiset) {
return nil, nil
}
// Tips returns the current DAG tips
func (csm *ConsensusStateManager) Tips() []*model.DomainHash {
return nil
}
// VirtualData returns the medianTime and blueScore of the current virtual block
func (csm *ConsensusStateManager) VirtualData() (medianTime int64, blueScore uint64) {
return 0, 0
}
// RestoreUTXOSet calculates and returns the UTXOSet of the given blockHash
func (csm *ConsensusStateManager) RestoreUTXOSet(blockHash *model.DomainHash) model.ReadOnlyUTXOSet {
return nil
}