mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-06-05 13:46:42 +00:00
Fix pruning point anticone order (#1836)
* Send pruning point anticone in topological order Fix a UTXO pagination bug Lengthen the stabilization time for the last DAA test * Extend "sudden hash rate drop" test length to 45 minutes Co-authored-by: Kaspa Profiler <>
This commit is contained in:
parent
2dddb650b9
commit
ff72568d6b
@ -102,7 +102,7 @@ func (flow *handleRequestPruningPointUTXOSetFlow) sendPruningPointUTXOSet(
|
||||
return err
|
||||
}
|
||||
|
||||
if len(pruningPointUTXOs) < step {
|
||||
if len(pruningPointUTXOs) < step && chunksSent%ibdBatchSize == 0 {
|
||||
log.Debugf("Finished sending UTXOs for pruning block %s",
|
||||
msgRequestPruningPointUTXOSet.PruningPointHash)
|
||||
|
||||
|
@ -11,6 +11,7 @@ import (
|
||||
"github.com/kaspanet/kaspad/infrastructure/logger"
|
||||
"github.com/kaspanet/kaspad/util/staging"
|
||||
"github.com/pkg/errors"
|
||||
"sort"
|
||||
)
|
||||
|
||||
// pruningManager resolves and manages the current pruning point
|
||||
@ -928,7 +929,6 @@ func (pm *pruningManager) PruningPointAndItsAnticoneWithTrustedData() ([]*extern
|
||||
return nil, err
|
||||
}
|
||||
|
||||
blocks = append(blocks, pruningPointWithTrustedData)
|
||||
for _, blockHash := range pruningPointAnticone {
|
||||
blockWithTrustedData, err := pm.blockWithTrustedData(stagingArea, blockHash)
|
||||
if err != nil {
|
||||
@ -938,6 +938,14 @@ func (pm *pruningManager) PruningPointAndItsAnticoneWithTrustedData() ([]*extern
|
||||
blocks = append(blocks, blockWithTrustedData)
|
||||
}
|
||||
|
||||
// Sorting the blocks in topological order
|
||||
sort.Slice(blocks, func(i, j int) bool {
|
||||
return blocks[i].Block.Header.BlueWork().Cmp(blocks[j].Block.Header.BlueWork()) < 0
|
||||
})
|
||||
|
||||
// The pruning point should always come first
|
||||
blocks = append([]*externalapi.BlockWithTrustedData{pruningPointWithTrustedData}, blocks...)
|
||||
|
||||
return blocks, nil
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ func TestDAA(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "sudden hash rate drop",
|
||||
runDuration: 15 * time.Minute,
|
||||
runDuration: 45 * time.Minute,
|
||||
targetHashNanosecondsFunction: func(totalElapsedDuration time.Duration) int64 {
|
||||
if totalElapsedDuration < 5*time.Minute {
|
||||
return machineHashNanoseconds * 2
|
||||
@ -130,7 +130,7 @@ func TestDAA(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "constant exponential hash rate decrease",
|
||||
runDuration: 15 * time.Minute,
|
||||
runDuration: 45 * time.Minute,
|
||||
targetHashNanosecondsFunction: func(totalElapsedDuration time.Duration) int64 {
|
||||
fromHashNanoseconds := machineHashNanoseconds * 2
|
||||
toHashNanoseconds := machineHashNanoseconds * 10
|
||||
|
Loading…
x
Reference in New Issue
Block a user