Skip to content

Commit aa05a62

Browse files
committed
use dynamic fee rate for timeout refund tx
1 parent 395749e commit aa05a62

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

x/lending/keeper/dlc.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,13 @@ func (k Keeper) UpdateDLCMeta(ctx sdk.Context, loanId string, depositTxs []*psbt
100100
return err
101101
}
102102

103-
timeoutRefundTx, err := types.CreateTimeoutRefundTransaction(depositTxs, vaultPkScript, borrowerPkScript, internalKey, dlcMeta.TimeoutRefundScript, 1)
103+
// get fee rate
104+
feeRate := k.BtcBridgeKeeper().GetFeeRate(ctx)
105+
if feeRate.Value == 0 {
106+
feeRate.Value = types.DefaultFeeRate
107+
}
108+
109+
timeoutRefundTx, err := types.CreateTimeoutRefundTransaction(depositTxs, vaultPkScript, borrowerPkScript, internalKey, dlcMeta.TimeoutRefundScript, feeRate.Value)
104110
if err != nil {
105111
return err
106112
}

x/lending/types/lending.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ var (
2424

2525
// initial borrow index
2626
InitialBorrowIndex = sdkmath.LegacyOneDec()
27+
28+
// default fee rate
29+
DefaultFeeRate = int64(1)
2730
)
2831

2932
// GetExchangeRate calculates the sToken exchange rate according to the given params

0 commit comments

Comments
 (0)