Co-authored-by: james.zhang <68689915+zenzenless@users.noreply.github.com>
This commit is contained in:
parent
d32e1eab16
commit
a7a9bcb0f7
@ -12,7 +12,6 @@ import (
|
||||
cfg "github.com/cometbft/cometbft/config"
|
||||
|
||||
"cosmossdk.io/core/address"
|
||||
stakingtypes "cosmossdk.io/x/staking/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
@ -120,11 +119,12 @@ func CollectTxs(txJSONDecoder sdk.TxDecoder, moniker, genTxsDir string,
|
||||
// genesis transactions must be single-message
|
||||
msgs := genTx.GetMsgs()
|
||||
|
||||
// TODO abstract out staking message validation back to staking
|
||||
msg := msgs[0].(*stakingtypes.MsgCreateValidator)
|
||||
|
||||
msg, ok := msgs[0].(msgWithMoniker)
|
||||
if !ok {
|
||||
return appGenTxs, persistentPeers, fmt.Errorf("expected msgWithMoniker, got %T", msgs[0])
|
||||
}
|
||||
// exclude itself from persistent peers
|
||||
if msg.Description.Moniker != moniker {
|
||||
if msg.GetMoniker() != moniker {
|
||||
addressesIPs = append(addressesIPs, nodeAddrIP)
|
||||
}
|
||||
}
|
||||
@ -134,3 +134,8 @@ func CollectTxs(txJSONDecoder sdk.TxDecoder, moniker, genTxsDir string,
|
||||
|
||||
return appGenTxs, persistentPeers, nil
|
||||
}
|
||||
|
||||
// MsgWithMoniker must have GetMoniker() method to use CollectTx
|
||||
type msgWithMoniker interface {
|
||||
GetMoniker() string
|
||||
}
|
||||
|
||||
@ -90,6 +90,11 @@ func (msg MsgCreateValidator) Validate(ac address.Codec) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetMoniker returns the moniker of the validator
|
||||
func (msg MsgCreateValidator) GetMoniker() string {
|
||||
return msg.Description.GetMoniker()
|
||||
}
|
||||
|
||||
// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces
|
||||
func (msg MsgCreateValidator) UnpackInterfaces(unpacker gogoprotoany.AnyUnpacker) error {
|
||||
var pubKey cryptotypes.PubKey
|
||||
|
||||
Loading…
Reference in New Issue
Block a user