wormchain: tokenbridge: Don't allow self-registration
Don't allow registering an emitter for wormhole chain on wormhole chain.
This commit is contained in:
parent
5666ee51b5
commit
832a72057d
|
@ -84,6 +84,10 @@ func (k msgServer) ExecuteGovernanceVAA(goCtx context.Context, msg *types.MsgExe
|
||||||
chainId := binary.BigEndian.Uint16(payload[:2])
|
chainId := binary.BigEndian.Uint16(payload[:2])
|
||||||
bridgeEmitter := payload[2:34]
|
bridgeEmitter := payload[2:34]
|
||||||
|
|
||||||
|
if chainId == uint16(wormholeConfig.ChainId) {
|
||||||
|
return nil, types.ErrRegisterWormholeChain
|
||||||
|
}
|
||||||
|
|
||||||
if _, found := k.GetChainRegistration(ctx, uint32(chainId)); found {
|
if _, found := k.GetChainRegistration(ctx, uint32(chainId)); found {
|
||||||
return nil, types.ErrChainAlreadyRegistered
|
return nil, types.ErrChainAlreadyRegistered
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,4 +38,5 @@ var (
|
||||||
ErrAmountTooHigh = sdkerrors.Register(ModuleName, 1133, "the amount would exceed the bridges capacity of u64")
|
ErrAmountTooHigh = sdkerrors.Register(ModuleName, 1133, "the amount would exceed the bridges capacity of u64")
|
||||||
ErrAssetMetaRollback = sdkerrors.Register(ModuleName, 1134, "asset meta must have a higher sequence than the last update")
|
ErrAssetMetaRollback = sdkerrors.Register(ModuleName, 1134, "asset meta must have a higher sequence than the last update")
|
||||||
ErrNegativeFee = sdkerrors.Register(ModuleName, 1135, "fee cannot be negative")
|
ErrNegativeFee = sdkerrors.Register(ModuleName, 1135, "fee cannot be negative")
|
||||||
|
ErrRegisterWormholeChain = sdkerrors.Register(ModuleName, 1136, "cannot register an emitter for wormhole-chain on wormhole-chain")
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue