Skip to content
This repository was archived by the owner on Mar 19, 2025. It is now read-only.

Commit 06b525f

Browse files
committed
optimize
1 parent e70c608 commit 06b525f

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

x/btcbridge/keeper/keeper_withdraw.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,10 @@ func (k Keeper) NewSigningRequest(ctx sdk.Context, sender string, coin sdk.Coin,
7070
k.LockUTXOs(ctx, selectedUTXOs)
7171

7272
// save the change utxo and mark minted
73-
k.saveUTXO(ctx, changeUTXO)
74-
k.addToMintHistory(ctx, psbt.UnsignedTx.TxHash().String())
73+
if changeUTXO != nil {
74+
k.saveUTXO(ctx, changeUTXO)
75+
k.addToMintHistory(ctx, psbt.UnsignedTx.TxHash().String())
76+
}
7577

7678
signingRequest := &types.BitcoinSigningRequest{
7779
Address: sender,

x/btcbridge/keeper/msg_server.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,11 @@ func (m msgServer) SubmitWithdrawSignatures(goCtx context.Context, msg *types.Ms
170170
if err != nil {
171171
return nil, err
172172
}
173+
174+
if packet.UnsignedTx.TxHash().String() != msg.Txid {
175+
return nil, types.ErrInvalidSignatures
176+
}
177+
173178
if err = packet.SanityCheck(); err != nil {
174179
return nil, err
175180
}

0 commit comments

Comments
 (0)