github.com/TrueBlocks/trueblocks-core/src/apps/chifra@v0.0.0-20241022031540-b362680128f7/internal/when/handle_ts_truncate.go (about) 1 // Copyright 2021 The TrueBlocks Authors. All rights reserved. 2 // Use of this source code is governed by a license that can 3 // be found in the LICENSE file. 4 5 package whenPkg 6 7 import ( 8 "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/logger" 9 "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output" 10 "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/tslib" 11 ) 12 13 // HandleTimestampsTruncate handles chifra when --timestamps --drop <bn> 14 func (opts *WhenOptions) HandleTimestampsTruncate(rCtx *output.RenderCtx) error { 15 chain := opts.Globals.Chain 16 17 if err := tslib.Truncate(chain, opts.Truncate+1); err != nil { 18 return err 19 } 20 21 logger.Info("The timestamps file was trucated to block", opts.Truncate) 22 return nil 23 }