mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-06-06 22:26:47 +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
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(pruningPointUTXOs) < step {
|
if len(pruningPointUTXOs) < step && chunksSent%ibdBatchSize == 0 {
|
||||||
log.Debugf("Finished sending UTXOs for pruning block %s",
|
log.Debugf("Finished sending UTXOs for pruning block %s",
|
||||||
msgRequestPruningPointUTXOSet.PruningPointHash)
|
msgRequestPruningPointUTXOSet.PruningPointHash)
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ import (
|
|||||||
"github.com/kaspanet/kaspad/infrastructure/logger"
|
"github.com/kaspanet/kaspad/infrastructure/logger"
|
||||||
"github.com/kaspanet/kaspad/util/staging"
|
"github.com/kaspanet/kaspad/util/staging"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
"sort"
|
||||||
)
|
)
|
||||||
|
|
||||||
// pruningManager resolves and manages the current pruning point
|
// pruningManager resolves and manages the current pruning point
|
||||||
@ -928,7 +929,6 @@ func (pm *pruningManager) PruningPointAndItsAnticoneWithTrustedData() ([]*extern
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
blocks = append(blocks, pruningPointWithTrustedData)
|
|
||||||
for _, blockHash := range pruningPointAnticone {
|
for _, blockHash := range pruningPointAnticone {
|
||||||
blockWithTrustedData, err := pm.blockWithTrustedData(stagingArea, blockHash)
|
blockWithTrustedData, err := pm.blockWithTrustedData(stagingArea, blockHash)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -938,6 +938,14 @@ func (pm *pruningManager) PruningPointAndItsAnticoneWithTrustedData() ([]*extern
|
|||||||
blocks = append(blocks, blockWithTrustedData)
|
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
|
return blocks, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ func TestDAA(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "sudden hash rate drop",
|
name: "sudden hash rate drop",
|
||||||
runDuration: 15 * time.Minute,
|
runDuration: 45 * time.Minute,
|
||||||
targetHashNanosecondsFunction: func(totalElapsedDuration time.Duration) int64 {
|
targetHashNanosecondsFunction: func(totalElapsedDuration time.Duration) int64 {
|
||||||
if totalElapsedDuration < 5*time.Minute {
|
if totalElapsedDuration < 5*time.Minute {
|
||||||
return machineHashNanoseconds * 2
|
return machineHashNanoseconds * 2
|
||||||
@ -130,7 +130,7 @@ func TestDAA(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "constant exponential hash rate decrease",
|
name: "constant exponential hash rate decrease",
|
||||||
runDuration: 15 * time.Minute,
|
runDuration: 45 * time.Minute,
|
||||||
targetHashNanosecondsFunction: func(totalElapsedDuration time.Duration) int64 {
|
targetHashNanosecondsFunction: func(totalElapsedDuration time.Duration) int64 {
|
||||||
fromHashNanoseconds := machineHashNanoseconds * 2
|
fromHashNanoseconds := machineHashNanoseconds * 2
|
||||||
toHashNanoseconds := machineHashNanoseconds * 10
|
toHashNanoseconds := machineHashNanoseconds * 10
|
||||||
|
Loading…
x
Reference in New Issue
Block a user