github.com/TrueBlocks/trueblocks-core/src/apps/chifra@v0.0.0-20241022031540-b362680128f7/internal/chunks/handle_unpin.go (about)

     1  package chunksPkg
     2  
     3  import (
     4  	"github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/base"
     5  	"github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger"
     6  	"github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output"
     7  	"github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/pinning"
     8  )
     9  
    10  func (opts *ChunksOptions) HandleUnpin(rCtx *output.RenderCtx, blockNums []base.Blknum) error {
    11  	testMode := opts.Globals.TestMode
    12  	if testMode {
    13  		logger.Info("Test mode: unpin not tested")
    14  		return nil
    15  	}
    16  
    17  	if opts.Sleep == 0.0 {
    18  		opts.Sleep = 1.0
    19  	}
    20  	_ = pinning.Unpin(opts.Globals.Chain, opts.Count, opts.Sleep)
    21  
    22  	return nil
    23  }