wormchain: tokenbridge: Check that the target chain is registered
Ensure that the destination chain has been registered in the tokenbridge before allowing transfers to it. This prevents users from accidentally locking up their tokens in the token bridge by passing in an invalid chain id.
This commit is contained in:
parent
d272eee7bc
commit
b38180bf5d
|
@ -26,6 +26,10 @@ func (k msgServer) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*typ
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if _, found := k.GetChainRegistration(ctx, msg.ToChain); !found {
|
||||||
|
return nil, types.ErrInvalidTargetChain
|
||||||
|
}
|
||||||
|
|
||||||
meta, found := k.bankKeeper.GetDenomMetaData(ctx, msg.Amount.Denom)
|
meta, found := k.bankKeeper.GetDenomMetaData(ctx, msg.Amount.Denom)
|
||||||
if !found {
|
if !found {
|
||||||
return nil, types.ErrNoDenomMetadata
|
return nil, types.ErrNoDenomMetadata
|
||||||
|
|
Loading…
Reference in New Issue