mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-22 22:25:24 +01:00
sweep: change MaxInputsPerTx
from int
to uint32
This commit is contained in:
parent
521b1fc34a
commit
d0a8f27d84
5 changed files with 9 additions and 9 deletions
|
@ -35,7 +35,7 @@ type inputCluster struct {
|
||||||
// inputs are skipped. No input sets with a total value after fees below the
|
// inputs are skipped. No input sets with a total value after fees below the
|
||||||
// dust limit are returned.
|
// dust limit are returned.
|
||||||
func (c *inputCluster) createInputSets(maxFeeRate chainfee.SatPerKWeight,
|
func (c *inputCluster) createInputSets(maxFeeRate chainfee.SatPerKWeight,
|
||||||
maxInputs int) []InputSet {
|
maxInputs uint32) []InputSet {
|
||||||
|
|
||||||
// Turn the inputs into a slice so we can sort them.
|
// Turn the inputs into a slice so we can sort them.
|
||||||
inputList := make([]*pendingInput, 0, len(c.inputs))
|
inputList := make([]*pendingInput, 0, len(c.inputs))
|
||||||
|
@ -138,7 +138,7 @@ type SimpleAggregator struct {
|
||||||
// MaxInputsPerTx specifies the default maximum number of inputs allowed
|
// MaxInputsPerTx specifies the default maximum number of inputs allowed
|
||||||
// in a single sweep tx. If more need to be swept, multiple txes are
|
// in a single sweep tx. If more need to be swept, multiple txes are
|
||||||
// created and published.
|
// created and published.
|
||||||
MaxInputsPerTx int
|
MaxInputsPerTx uint32
|
||||||
|
|
||||||
// FeeRateBucketSize is the default size of fee rate buckets we'll use
|
// FeeRateBucketSize is the default size of fee rate buckets we'll use
|
||||||
// when clustering inputs into buckets with similar fee rates within
|
// when clustering inputs into buckets with similar fee rates within
|
||||||
|
@ -158,7 +158,7 @@ var _ UtxoAggregator = (*SimpleAggregator)(nil)
|
||||||
|
|
||||||
// NewSimpleUtxoAggregator creates a new instance of a SimpleAggregator.
|
// NewSimpleUtxoAggregator creates a new instance of a SimpleAggregator.
|
||||||
func NewSimpleUtxoAggregator(estimator chainfee.Estimator,
|
func NewSimpleUtxoAggregator(estimator chainfee.Estimator,
|
||||||
max chainfee.SatPerKWeight, maxTx int) *SimpleAggregator {
|
max chainfee.SatPerKWeight, maxTx uint32) *SimpleAggregator {
|
||||||
|
|
||||||
return &SimpleAggregator{
|
return &SimpleAggregator{
|
||||||
FeeEstimator: estimator,
|
FeeEstimator: estimator,
|
||||||
|
|
|
@ -335,7 +335,7 @@ type UtxoSweeperConfig struct {
|
||||||
// MaxInputsPerTx specifies the default maximum number of inputs allowed
|
// MaxInputsPerTx specifies the default maximum number of inputs allowed
|
||||||
// in a single sweep tx. If more need to be swept, multiple txes are
|
// in a single sweep tx. If more need to be swept, multiple txes are
|
||||||
// created and published.
|
// created and published.
|
||||||
MaxInputsPerTx int
|
MaxInputsPerTx uint32
|
||||||
|
|
||||||
// MaxSweepAttempts specifies the maximum number of times an input is
|
// MaxSweepAttempts specifies the maximum number of times an input is
|
||||||
// included in a publish attempt before giving up and returning an error
|
// included in a publish attempt before giving up and returning an error
|
||||||
|
|
|
@ -30,7 +30,7 @@ var (
|
||||||
|
|
||||||
testMaxSweepAttempts = 3
|
testMaxSweepAttempts = 3
|
||||||
|
|
||||||
testMaxInputsPerTx = 3
|
testMaxInputsPerTx = uint32(3)
|
||||||
|
|
||||||
defaultFeePref = Params{Fee: FeeEstimateInfo{ConfTarget: 1}}
|
defaultFeePref = Params{Fee: FeeEstimateInfo{ConfTarget: 1}}
|
||||||
)
|
)
|
||||||
|
|
|
@ -139,7 +139,7 @@ type txInputSet struct {
|
||||||
|
|
||||||
// maxInputs is the maximum number of inputs that will be accepted in
|
// maxInputs is the maximum number of inputs that will be accepted in
|
||||||
// the set.
|
// the set.
|
||||||
maxInputs int
|
maxInputs uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compile-time constraint to ensure txInputSet implements InputSet.
|
// Compile-time constraint to ensure txInputSet implements InputSet.
|
||||||
|
@ -147,7 +147,7 @@ var _ InputSet = (*txInputSet)(nil)
|
||||||
|
|
||||||
// newTxInputSet constructs a new, empty input set.
|
// newTxInputSet constructs a new, empty input set.
|
||||||
func newTxInputSet(feePerKW, maxFeeRate chainfee.SatPerKWeight,
|
func newTxInputSet(feePerKW, maxFeeRate chainfee.SatPerKWeight,
|
||||||
maxInputs int) *txInputSet {
|
maxInputs uint32) *txInputSet {
|
||||||
|
|
||||||
state := txInputSetState{
|
state := txInputSetState{
|
||||||
feeRate: feePerKW,
|
feeRate: feePerKW,
|
||||||
|
@ -215,7 +215,7 @@ func (t *txInputSet) addToState(inp input.Input,
|
||||||
// Stop if max inputs is reached. Do not count additional wallet inputs,
|
// Stop if max inputs is reached. Do not count additional wallet inputs,
|
||||||
// because we don't know in advance how many we may need.
|
// because we don't know in advance how many we may need.
|
||||||
if constraints != constraintsWallet &&
|
if constraints != constraintsWallet &&
|
||||||
len(t.inputs) >= t.maxInputs {
|
uint32(len(t.inputs)) >= t.maxInputs {
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ var (
|
||||||
// DefaultMaxInputsPerTx specifies the default maximum number of inputs
|
// DefaultMaxInputsPerTx specifies the default maximum number of inputs
|
||||||
// allowed in a single sweep tx. If more need to be swept, multiple txes
|
// allowed in a single sweep tx. If more need to be swept, multiple txes
|
||||||
// are created and published.
|
// are created and published.
|
||||||
DefaultMaxInputsPerTx = 100
|
DefaultMaxInputsPerTx = uint32(100)
|
||||||
|
|
||||||
// ErrLocktimeConflict is returned when inputs with different
|
// ErrLocktimeConflict is returned when inputs with different
|
||||||
// transaction nLockTime values are included in the same transaction.
|
// transaction nLockTime values are included in the same transaction.
|
||||||
|
|
Loading…
Add table
Reference in a new issue