@@ -105,8 +105,8 @@ func (k Keeper) IterateIBCWithdrawRequestQueue(ctx sdk.Context, cb func(req *typ
105105 }
106106}
107107
108- // CheckSBTCAutoPegOut returns true if the given packet is to receive native sBTC and auto-pegout enabled , false otherwise
109- func (k Keeper ) CheckSBTCAutoPegOut (ctx sdk.Context , packet ibcexported.PacketI , data transfertypes.FungibleTokenPacketData ) bool {
108+ // CheckSBTC returns true if the given packet is to receive native sBTC, false otherwise
109+ func (k Keeper ) CheckSBTC (ctx sdk.Context , packet ibcexported.PacketI , data transfertypes.FungibleTokenPacketData ) bool {
110110 // check if the receiving chain is source
111111 if ! transfertypes .ReceiverChainIsSource (packet .GetSourcePort (), packet .GetSourceChannel (), data .Denom ) {
112112 return false
@@ -118,7 +118,7 @@ func (k Keeper) CheckSBTCAutoPegOut(ctx sdk.Context, packet ibcexported.PacketI,
118118 // remove sender prefix
119119 unprefixedDenom := data .Denom [len (prefix ):]
120120
121- return unprefixedDenom == k .BtcDenom (ctx ) && data . Memo == types . FlagAutoPegOut
121+ return unprefixedDenom == k .BtcDenom (ctx )
122122}
123123
124124// GetClientHeight gets the current client height by the given source port and channel
@@ -188,14 +188,19 @@ func (k Keeper) IBCReceivePacketCallback(
188188 ack ibcexported.Acknowledgement ,
189189 contractAddress string ,
190190) error {
191+ // check if the callback address is the expected address
192+ if contractAddress != types .CallbackAddress {
193+ return nil
194+ }
195+
191196 // check if withdrawal is enabled
192197 if ! k .WithdrawEnabled (ctx ) {
193198 return nil
194199 }
195200
196201 // check if the packet is sBTC token transfer and auto-pegout enabled
197202 data , ok := tryGetFungibleTokenPacketData (packet )
198- if ! ok || ! k .CheckSBTCAutoPegOut (ctx , packet , data ) {
203+ if ! ok || ! k .CheckSBTC (ctx , packet , data ) {
199204 return nil
200205 }
201206
0 commit comments