From 411c44c24fcd4c95cbe43581e2b8db2113ea4952 Mon Sep 17 00:00:00 2001 From: shiwei <15652931283@163.com> Date: Wed, 24 Jul 2024 17:31:56 +0800 Subject: [PATCH] update node --- modules/node/abci.go | 4 ++-- modules/node/genesis.go | 4 ++-- modules/node/module.go | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/node/abci.go b/modules/node/abci.go index 0aafa053..f8e928b8 100644 --- a/modules/node/abci.go +++ b/modules/node/abci.go @@ -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 } diff --git a/modules/node/genesis.go b/modules/node/genesis.go index 73d3769d..2ee41afd 100644 --- a/modules/node/genesis.go +++ b/modules/node/genesis.go @@ -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()) } @@ -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)) } diff --git a/modules/node/module.go b/modules/node/module.go index 105a08db..45f749e0 100644 --- a/modules/node/module.go +++ b/modules/node/module.go @@ -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) } @@ -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) } // ____________________________________________________________________________