Skip to content

Commit

Permalink
update node
Browse files Browse the repository at this point in the history
  • Loading branch information
sin3A committed Jul 24, 2024
1 parent 13ed118 commit 411c44c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions modules/node/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import (

// BeginBlocker will persist the current header and validator set as a historical entry
// and prune the oldest entry based on the HistoricalEntries parameter
func BeginBlocker(ctx sdk.Context, k keeper.Keeper) {
func BeginBlocker(ctx sdk.Context, k *keeper.Keeper) {
k.TrackHistoricalInfo(ctx)
}

// Called every block, update validator set
func EndBlocker(ctx sdk.Context, k keeper.Keeper) (updates []abci.ValidatorUpdate) {
func EndBlocker(ctx sdk.Context, k *keeper.Keeper) (updates []abci.ValidatorUpdate) {
updates, _ = k.ApplyAndReturnValidatorSetUpdates(ctx)
return updates
}
4 changes: 2 additions & 2 deletions modules/node/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
)

// InitGenesis - store genesis validator set
func InitGenesis(ctx sdk.Context, cdc codec.Codec, k Keeper, data GenesisState) (res []abci.ValidatorUpdate) {
func InitGenesis(ctx sdk.Context, cdc codec.Codec, k *Keeper, data GenesisState) (res []abci.ValidatorUpdate) {
if err := ValidateGenesis(data); err != nil {
panic(err.Error())
}
Expand Down Expand Up @@ -66,7 +66,7 @@ func InitGenesis(ctx sdk.Context, cdc codec.Codec, k Keeper, data GenesisState)
}

// ExportGenesis - output genesis valiadtor set
func ExportGenesis(ctx sdk.Context, k Keeper) *GenesisState {
func ExportGenesis(ctx sdk.Context, k *Keeper) *GenesisState {
rootCert, _ := k.GetRootCert(ctx)
return NewGenesisState(rootCert, k.GetParams(ctx), k.GetAllValidators(ctx), k.GetNodes(ctx))
}
Expand Down
8 changes: 4 additions & 4 deletions modules/node/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,12 @@ func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {}
func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate {
var genesisState GenesisState
cdc.MustUnmarshalJSON(data, &genesisState)
return InitGenesis(ctx, am.cdc, *am.keeper, genesisState)
return InitGenesis(ctx, am.cdc, am.keeper, genesisState)
}

// ExportGenesis returns the exported genesis state as raw bytes for the node module.
func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage {
gs := ExportGenesis(ctx, *am.keeper)
gs := ExportGenesis(ctx, am.keeper)
return cdc.MustMarshalJSON(gs)
}

Expand All @@ -169,12 +169,12 @@ func (AppModule) ConsensusVersion() uint64 { return 1 }

// BeginBlock returns the begin blocker for the node module.
func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) {
BeginBlocker(ctx, *am.keeper)
BeginBlocker(ctx, am.keeper)
}

// EndBlock returns the end blocker for the node module. It returns no validator updates.
func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate {
return EndBlocker(ctx, *am.keeper)
return EndBlocker(ctx, am.keeper)
}

// ____________________________________________________________________________
Expand Down

0 comments on commit 411c44c

Please sign in to comment.