Skip to content

Commit 6a4f00c

Browse files
committed
adjust sequence
1 parent f9935dc commit 6a4f00c

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

x/lending/types/bitcoin.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ const (
1515
// default tx version
1616
TxVersion = 2
1717

18+
// default sequence
19+
DefaultSequence = 0
20+
1821
// default maximum allowed transaction weight
1922
MaxTransactionWeight = 400000
20-
21-
// default sequence
22-
DefaultSequence = wire.MaxTxInSequenceNum - 1
2323
)
2424

2525
// BuildPsbt builds a psbt from the given params

x/lending/types/dlc.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"github.com/btcsuite/btcd/btcutil/psbt"
1111
"github.com/btcsuite/btcd/chaincfg/chainhash"
1212
"github.com/btcsuite/btcd/txscript"
13+
"github.com/btcsuite/btcd/wire"
1314

1415
errorsmod "cosmossdk.io/errors"
1516

@@ -23,6 +24,9 @@ const (
2324
// default sig hash type
2425
DefaultSigHashType = txscript.SigHashDefault
2526

27+
// liquidation cet sequence
28+
LiquidationCetSequence = wire.MaxTxInSequenceNum
29+
2630
// default fee rate
2731
DefaultFeeRate = 1
2832
)
@@ -159,6 +163,10 @@ func VerifyLiquidationCet(dlcMeta *DLCMeta, depositTxs []*psbt.Packet, vaultPkSc
159163
return errorsmod.Wrap(ErrInvalidCET, "incorrect previous tx out index")
160164
}
161165

166+
if txIn.Sequence != LiquidationCetSequence {
167+
return errorsmod.Wrap(ErrInvalidCET, "invalid sequence")
168+
}
169+
162170
if p.Inputs[i].WitnessUtxo == nil {
163171
return errorsmod.Wrap(ErrInvalidCET, "missing witness utxo")
164172
}

x/liquidation/types/bitcoin.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ const (
2222
// default tx version
2323
TxVersion = 2
2424

25+
// default sequence
26+
DefaultSequence = 0
27+
2528
// default sig hash type
2629
DefaultSigHashType = txscript.SigHashDefault
27-
28-
// default sequence
29-
DefaultSequence = wire.MaxTxInSequenceNum - 1
3030
)
3131

3232
// BuildSettlementTransaction builds the settlement tx for the given liquidation and records

0 commit comments

Comments
 (0)