Skip to content

Commit

Permalink
Set minimum trim depth to MaxInt blocks and set soft max UTXO set siz…
Browse files Browse the repository at this point in the history
…e to 10m
  • Loading branch information
jdowning100 committed Oct 14, 2024
1 parent 7a8bcd5 commit 53eeb53
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
6 changes: 4 additions & 2 deletions consensus/blake3pow/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ func (blake3pow *Blake3pow) Finalize(chain consensus.ChainHeaderReader, batch et
var wg sync.WaitGroup
var lock sync.Mutex
for denomination, depth := range trimDepths {
if denomination <= types.MaxTrimDenomination && header.NumberU64(nodeCtx) > depth+1 {
if denomination <= types.MaxTrimDenomination && header.NumberU64(nodeCtx) > depth+params.MinimumTrimDepth {
wg.Add(1)
go func(denomination uint8, depth uint64) {
defer func() {
Expand Down Expand Up @@ -735,7 +735,9 @@ func (blake3pow *Blake3pow) Finalize(chain consensus.ChainHeaderReader, batch et
}()
}
wg.Wait()
blake3pow.logger.Infof("Trimmed %d UTXOs from db in %s", len(trimmedUtxos), common.PrettyDuration(time.Since(start)))
if len(trimmedUtxos) > 0 {
blake3pow.logger.Infof("Trimmed %d UTXOs from db in %s", len(trimmedUtxos), common.PrettyDuration(time.Since(start)))
}
if !setRoots {
rawdb.WriteTrimmedUTXOs(batch, header.Hash(), trimmedUtxos)
if len(newCollidingKeys) > 0 {
Expand Down
6 changes: 4 additions & 2 deletions consensus/progpow/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ func (progpow *Progpow) Finalize(chain consensus.ChainHeaderReader, batch ethdb.
var wg sync.WaitGroup
var lock sync.Mutex
for denomination, depth := range trimDepths {
if denomination <= types.MaxTrimDenomination && header.NumberU64(nodeCtx) > depth+1 {
if denomination <= types.MaxTrimDenomination && header.NumberU64(nodeCtx) > depth+params.MinimumTrimDepth {
wg.Add(1)
go func(denomination uint8, depth uint64) {
defer func() {
Expand Down Expand Up @@ -793,7 +793,9 @@ func (progpow *Progpow) Finalize(chain consensus.ChainHeaderReader, batch ethdb.
}()
}
wg.Wait()
progpow.logger.Infof("Trimmed %d UTXOs from db in %s", len(trimmedUtxos), common.PrettyDuration(time.Since(start)))
if len(trimmedUtxos) > 0 {
progpow.logger.Infof("Trimmed %d UTXOs from db in %s", len(trimmedUtxos), common.PrettyDuration(time.Since(start)))
}
if !setRoots {
rawdb.WriteTrimmedUTXOs(batch, header.Hash(), trimmedUtxos)
if len(newCollidingKeys) > 0 {
Expand Down
3 changes: 2 additions & 1 deletion params/protocol_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ const (
ConversionLockPeriod uint64 = 10 // The number of zone blocks that a conversion output is locked for
MinQiConversionDenomination = 1
ConversionConfirmationContext = common.PRIME_CTX // A conversion requires a single coincident Dom confirmation
SoftMaxUTXOSetSize = 1000000 // The maximum number of UTXOs that can be stored in the UTXO set
SoftMaxUTXOSetSize = 10000000 // The soft maximum number of UTXOs that can be stored in the UTXO set
MinimumTrimDepth = math.MaxInt // The minimum block depth of the chain to begin trimming
)

var (
Expand Down

0 comments on commit 53eeb53

Please sign in to comment.