mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-09-13 13:00:10 +00:00

* [NOD-616] Remove unused methods from BlockDAG. * [NOD-616] Remove Height from GetRawMempoolVerboseResult and TxDesc. * [NOD-616] Replaced BlockDAG.ChainHeight with SelectedTipBlueScore. * [NOD-616] Remove the unused BlockChainHeightByHash. * [NOD-616] Remove the unused blockChainHeight from checkBlockHeaderContext. * [NOD-616] Remove chainHeight from util.Block. * [NOD-616] Remove TestChainHeight. * [NOD-616] Update unknown rule activation warning to use blueScore. * [NOD-616] Update thresholdState to use blueScore instead of chainHeight. * [NOD-616] Update blockLocator to use blueScore instead of chainHeight. * [NOD-616] Remove blockNode.chainHeight. * [NOD-616] Fix comments and variable names. * [NOD-616] Replace a weird for loop with a while loop. * [NOD-616] Fix a comment. * [NOD-616] Remove pre-allocation in blockLocator. * [NOD-616] Coalesce checks that startHash and stopHash are not the same into the same condition. * [NOD-616] Fix a comment. * [NOD-616] Remove weird blueScore logic around childHashStrings. * [NOD-616] Fix hash pointer comparison. * [NOD-616] Fix a comment. * [NOD-616] Add ban score to peers misusing GetBlockLocator. * [NOD-616] Replace adding ban score with disconnecting. * [NOD-616] Add blueScore to FilteredBlockAddedNtfn.
28 lines
687 B
Go
28 lines
687 B
Go
package blockdag
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/kaspanet/kaspad/dagconfig"
|
|
)
|
|
|
|
func TestAncestorErrors(t *testing.T) {
|
|
// Create a new database and DAG instance to run tests against.
|
|
params := dagconfig.SimnetParams
|
|
dag, teardownFunc, err := DAGSetup("TestAncestorErrors", Config{
|
|
DAGParams: ¶ms,
|
|
})
|
|
if err != nil {
|
|
t.Fatalf("TestAncestorErrors: Failed to setup DAG instance: %s", err)
|
|
}
|
|
defer teardownFunc()
|
|
|
|
node := newTestNode(dag, newSet(), int32(0x10000000), 0, time.Unix(0, 0))
|
|
node.blueScore = 2
|
|
ancestor := node.SelectedAncestor(3)
|
|
if ancestor != nil {
|
|
t.Errorf("TestAncestorErrors: Ancestor() unexpectedly returned a node. Expected: <nil>")
|
|
}
|
|
}
|