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

Commit 6b0374c

Browse files
committed
update type of fee rate
1 parent 0f3e6e6 commit 6b0374c

4 files changed

Lines changed: 60 additions & 32 deletions

File tree

proto/side/btcbridge/tx.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ message MsgWithdrawBitcoinRequest {
9696
// withdraw amount in satoshi, etc: 100000000sat = 1btc
9797
string amount = 2;
9898
// fee rate in sats/vB
99-
int64 fee_rate = 3;
99+
string fee_rate = 3;
100100
}
101101

102102
// MsgWithdrawBitcoinResponse defines the Msg/WithdrawBitcoin response type.

x/btcbridge/keeper/msg_server.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"bytes"
55
"context"
66
"encoding/base64"
7+
"strconv"
78

89
"github.com/btcsuite/btcd/btcutil/psbt"
910
sdk "github.com/cosmos/cosmos-sdk/types"
@@ -137,7 +138,11 @@ func (m msgServer) WithdrawBitcoin(goCtx context.Context, msg *types.MsgWithdraw
137138
return nil, err
138139
}
139140

140-
_, err = m.Keeper.NewSigningRequest(ctx, msg.Sender, coin, msg.FeeRate, "")
141+
feeRate, err := strconv.ParseInt(msg.FeeRate, 10, 64)
142+
if err != nil {
143+
return nil, err
144+
}
145+
_, err = m.Keeper.NewSigningRequest(ctx, msg.Sender, coin, feeRate, "")
141146
if err != nil {
142147
return nil, err
143148
}

x/btcbridge/types/message_withdraw_bitcoin.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package types
22

33
import (
4+
"strconv"
5+
46
sdkerrors "cosmossdk.io/errors"
57
sdk "github.com/cosmos/cosmos-sdk/types"
68
)
@@ -10,7 +12,7 @@ const TypeMsgWithdrawBitcoin = "withdraw_bitcoin"
1012
func NewMsgWithdrawBitcoinRequest(
1113
sender string,
1214
amount string,
13-
feeRate int64,
15+
feeRate string,
1416
) *MsgWithdrawBitcoinRequest {
1517
return &MsgWithdrawBitcoinRequest{
1618
Sender: sender,
@@ -56,7 +58,12 @@ func (msg *MsgWithdrawBitcoinRequest) ValidateBasic() error {
5658
return err
5759
}
5860

59-
if msg.FeeRate <= 0 {
61+
feeRate, err := strconv.ParseInt(msg.FeeRate, 10, 64)
62+
if err != nil {
63+
return err
64+
}
65+
66+
if feeRate <= 0 {
6067
return sdkerrors.Wrap(ErrInvalidFeeRate, "fee rate must be greater than zero")
6168
}
6269

x/btcbridge/types/tx.pb.go

Lines changed: 44 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)