mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-05-23 15:26:42 +00:00

* Get rid of insertMode * Rename AddBlockToVirtual->AddBlock * When F is not in the future of P, enforce finality with P and not with F. * Don't allow blocks with invalid parents or with missing block body * Check finality violation before checking block status * Implement CalculateIndependentPruningPoint * Move checkBlockStatus to validateBlock * Add ValidateBlock to block processor interface * Adjust SetPruningPoint to the new IBD flow * Add pruning store to CSM's constructor * Flip wrong condition on AddHeaderTip * Fix func (hts *headerSelectedTipStore) Has * Fix block stage order * Call to ValidateBodyInContext from validatePostProofOfWork * Enable overrideDAGParams * Update log * Rename SetPruningPoint to ValidateAndInsertPruningPoint and move most of its logic inside block processor * Rename hasValidatedHeader->hasValidatedOnlyHeader * Fix typo * Name return values for fetchMissingUTXOSet * Add comment * Return ErrMissingParents when block body is missing * Add logs and comments * Fix merge error * Fix pruning point calculation to be by virtual selected parent * Replace CalculateIndependentPruningPoint to CalculatePruningPointByHeaderSelectedTip * Fix isAwaitingUTXOSet to check pruning point by headers * Change isAwaitingUTXOSet indication * Remove IsBlockInHeaderPruningPointFuture from BlockInfo * Fix LowestChainBlockAboveOrEqualToBlueScore * Add validateNewPruningPointTransactions * Add validateNewPruningAgainstPastUTXO * Rename set_pruning_utxo_set.go to update_pruning_utxo_set.go * Check missing block body hashes by missing block instead of status * Validate pruning point against past UTXO with the pruning point as block hash * Remove virtualHeaderHash * Fix comment * Fix imports
57 lines
2.2 KiB
Go
57 lines
2.2 KiB
Go
package testapi
|
|
|
|
import (
|
|
"github.com/kaspanet/kaspad/domain/consensus/model"
|
|
"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
|
|
"github.com/kaspanet/kaspad/domain/dagconfig"
|
|
)
|
|
|
|
// TestConsensus wraps the Consensus interface with some methods that are needed by tests only
|
|
type TestConsensus interface {
|
|
externalapi.Consensus
|
|
|
|
DAGParams() *dagconfig.Params
|
|
DatabaseContext() model.DBReader
|
|
|
|
BuildBlockWithParents(parentHashes []*externalapi.DomainHash, coinbaseData *externalapi.DomainCoinbaseData,
|
|
transactions []*externalapi.DomainTransaction) (*externalapi.DomainBlock, model.UTXODiff, error)
|
|
|
|
// AddBlock builds a block with given information, solves it, and adds to the DAG.
|
|
// Returns the hash of the added block
|
|
AddBlock(parentHashes []*externalapi.DomainHash, coinbaseData *externalapi.DomainCoinbaseData,
|
|
transactions []*externalapi.DomainTransaction) (*externalapi.DomainHash, error)
|
|
|
|
DiscardAllStores()
|
|
|
|
AcceptanceDataStore() model.AcceptanceDataStore
|
|
BlockHeaderStore() model.BlockHeaderStore
|
|
BlockRelationStore() model.BlockRelationStore
|
|
BlockStatusStore() model.BlockStatusStore
|
|
BlockStore() model.BlockStore
|
|
ConsensusStateStore() model.ConsensusStateStore
|
|
GHOSTDAGDataStore() model.GHOSTDAGDataStore
|
|
HeaderTipsStore() model.HeaderSelectedTipStore
|
|
MultisetStore() model.MultisetStore
|
|
PruningStore() model.PruningStore
|
|
ReachabilityDataStore() model.ReachabilityDataStore
|
|
UTXODiffStore() model.UTXODiffStore
|
|
|
|
BlockBuilder() TestBlockBuilder
|
|
BlockProcessor() model.BlockProcessor
|
|
BlockValidator() model.BlockValidator
|
|
CoinbaseManager() model.CoinbaseManager
|
|
ConsensusStateManager() TestConsensusStateManager
|
|
FinalityManager() model.FinalityManager
|
|
DAGTopologyManager() model.DAGTopologyManager
|
|
DAGTraversalManager() model.DAGTraversalManager
|
|
DifficultyManager() model.DifficultyManager
|
|
GHOSTDAGManager() model.GHOSTDAGManager
|
|
HeaderTipsManager() model.HeadersSelectedTipManager
|
|
MergeDepthManager() model.MergeDepthManager
|
|
PastMedianTimeManager() model.PastMedianTimeManager
|
|
PruningManager() model.PruningManager
|
|
ReachabilityManager() TestReachabilityManager
|
|
SyncManager() model.SyncManager
|
|
TransactionValidator() TestTransactionValidator
|
|
}
|