From 47c0382e2d8bc6156c86b2b2e55ff4944b91a95d Mon Sep 17 00:00:00 2001 From: Anonymous Date: Tue, 15 Apr 2025 22:21:07 +0700 Subject: [PATCH] add-epoch-number-for-XDPoS_getMasternodesByNumber --- consensus/XDPoS/api.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/consensus/XDPoS/api.go b/consensus/XDPoS/api.go index 420f0d7d59..b6cf51419f 100644 --- a/consensus/XDPoS/api.go +++ b/consensus/XDPoS/api.go @@ -65,6 +65,7 @@ type SignerTypes struct { } type MasternodesStatus struct { + Epoch uint64 Number uint64 Round types.Round MasternodesLen int @@ -147,11 +148,13 @@ func (api *API) GetMasternodesByNumber(number *rpc.BlockNumber) MasternodesStatu } } + epochNum := api.XDPoS.config.V2.SwitchEpoch + uint64(round)/api.XDPoS.config.Epoch masterNodes := api.XDPoS.EngineV2.GetMasternodes(api.chain, header) penalties := api.XDPoS.EngineV2.GetPenalties(api.chain, header) standbynodes := api.XDPoS.EngineV2.GetStandbynodes(api.chain, header) info := MasternodesStatus{ + Epoch: epochNum, Number: header.Number.Uint64(), Round: round, MasternodesLen: len(masterNodes),