github.com/lino-network/lino@v0.6.11/x/bandwidth/tick.go (about)

     1  package bandwidth
     2  
     3  import (
     4  	sdk "github.com/cosmos/cosmos-sdk/types"
     5  	abci "github.com/tendermint/tendermint/abci/types"
     6  )
     7  
     8  // BeginBlocker
     9  func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, bm BandwidthKeeper) {
    10  	if ctx.BlockHeight() == 1 {
    11  		err := bm.ReCalculateAppBandwidthInfo(ctx)
    12  		if err != nil {
    13  			panic(err)
    14  		}
    15  	}
    16  	if err := bm.BeginBlocker(ctx); err != nil {
    17  		panic(err)
    18  	}
    19  	return
    20  }
    21  
    22  // EndBlocker
    23  func EndBlocker(
    24  	ctx sdk.Context, req abci.RequestEndBlock, bm BandwidthKeeper) {
    25  	if err := bm.EndBlocker(ctx); err != nil {
    26  		panic(err)
    27  	}
    28  	return
    29  }