mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-20 05:42:05 +02:00
lnwallet+funding+lnd: trim unused parameters, from lnwallet.Config
chainreg: remove unused GenDefaultBtcConstraints lnwallet+funding+lnd: remove DefaultDustLimit from lnwallet.Config
This commit is contained in:
parent
c6ecb10865
commit
fb8de14798
@ -200,19 +200,6 @@ type ChainControl struct {
|
|||||||
Wallet *lnwallet.LightningWallet
|
Wallet *lnwallet.LightningWallet
|
||||||
}
|
}
|
||||||
|
|
||||||
// GenDefaultBtcConstraints generates the default set of channel constraints
|
|
||||||
// that are to be used when funding a Bitcoin channel.
|
|
||||||
func GenDefaultBtcConstraints() channeldb.ChannelConstraints {
|
|
||||||
// We use the dust limit for the maximally sized witness program with
|
|
||||||
// a 40-byte data push.
|
|
||||||
dustLimit := lnwallet.DustLimitForSize(input.UnknownWitnessSize)
|
|
||||||
|
|
||||||
return channeldb.ChannelConstraints{
|
|
||||||
DustLimit: dustLimit,
|
|
||||||
MaxAcceptedHtlcs: input.MaxHTLCNumber / 2,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewPartialChainControl creates a new partial chain control that contains all
|
// NewPartialChainControl creates a new partial chain control that contains all
|
||||||
// the parts that can be purely constructed from the passed in global
|
// the parts that can be purely constructed from the passed in global
|
||||||
// configuration and doesn't need any wallet instance yet.
|
// configuration and doesn't need any wallet instance yet.
|
||||||
|
@ -693,7 +693,6 @@ func (d *DefaultWalletImpl) BuildChainControl(
|
|||||||
FeeEstimator: partialChainControl.FeeEstimator,
|
FeeEstimator: partialChainControl.FeeEstimator,
|
||||||
SecretKeyRing: keyRing,
|
SecretKeyRing: keyRing,
|
||||||
ChainIO: walletController,
|
ChainIO: walletController,
|
||||||
DefaultConstraints: chainreg.GenDefaultBtcConstraints(),
|
|
||||||
NetParams: *walletConfig.NetParams,
|
NetParams: *walletConfig.NetParams,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -808,7 +807,6 @@ func (d *RPCSignerWalletImpl) BuildChainControl(
|
|||||||
FeeEstimator: partialChainControl.FeeEstimator,
|
FeeEstimator: partialChainControl.FeeEstimator,
|
||||||
SecretKeyRing: rpcKeyRing,
|
SecretKeyRing: rpcKeyRing,
|
||||||
ChainIO: walletController,
|
ChainIO: walletController,
|
||||||
DefaultConstraints: chainreg.GenDefaultBtcConstraints(),
|
|
||||||
NetParams: *walletConfig.NetParams,
|
NetParams: *walletConfig.NetParams,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -368,7 +368,6 @@ func createTestWallet(cdb *channeldb.ChannelStateDB, netParams *chaincfg.Params,
|
|||||||
ChainIO: bio,
|
ChainIO: bio,
|
||||||
FeeEstimator: estimator,
|
FeeEstimator: estimator,
|
||||||
NetParams: *netParams,
|
NetParams: *netParams,
|
||||||
DefaultConstraints: chainreg.GenDefaultBtcConstraints(),
|
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -49,10 +49,6 @@ type Config struct {
|
|||||||
// used to lookup the existence of outputs within the UTXO set.
|
// used to lookup the existence of outputs within the UTXO set.
|
||||||
ChainIO BlockChainIO
|
ChainIO BlockChainIO
|
||||||
|
|
||||||
// DefaultConstraints is the set of default constraints that will be
|
|
||||||
// used for any incoming or outgoing channel reservation requests.
|
|
||||||
DefaultConstraints channeldb.ChannelConstraints
|
|
||||||
|
|
||||||
// NetParams is the set of parameters that tells the wallet which chain
|
// NetParams is the set of parameters that tells the wallet which chain
|
||||||
// it will be operating on.
|
// it will be operating on.
|
||||||
NetParams chaincfg.Params
|
NetParams chaincfg.Params
|
||||||
|
@ -80,3 +80,8 @@ func DustLimitForSize(scriptSize int) btcutil.Amount {
|
|||||||
|
|
||||||
return dustlimit
|
return dustlimit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DustLimitUnknownWitness returns the dust limit for an UnknownWitnessSize.
|
||||||
|
func DustLimitUnknownWitness() btcutil.Amount {
|
||||||
|
return DustLimitForSize(input.UnknownWitnessSize)
|
||||||
|
}
|
||||||
|
@ -262,7 +262,7 @@ func NewChannelReservation(capacity, localFundingAmt btcutil.Amount,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Used to cut down on verbosity.
|
// Used to cut down on verbosity.
|
||||||
defaultDust := wallet.Cfg.DefaultConstraints.DustLimit
|
defaultDust := DustLimitUnknownWitness()
|
||||||
|
|
||||||
// If we're the responder to a single-funder reservation, then we have
|
// If we're the responder to a single-funder reservation, then we have
|
||||||
// no initial balance in the channel unless the remote party is pushing
|
// no initial balance in the channel unless the remote party is pushing
|
||||||
|
@ -356,13 +356,6 @@ func createTestWallet(tempTestDir string, miningNode *rpctest.Harness,
|
|||||||
Signer: signer,
|
Signer: signer,
|
||||||
ChainIO: bio,
|
ChainIO: bio,
|
||||||
FeeEstimator: chainfee.NewStaticEstimator(2500, 0),
|
FeeEstimator: chainfee.NewStaticEstimator(2500, 0),
|
||||||
DefaultConstraints: channeldb.ChannelConstraints{
|
|
||||||
DustLimit: 500,
|
|
||||||
MaxPendingAmount: lnwire.NewMSatFromSatoshis(btcutil.SatoshiPerBitcoin) * 100,
|
|
||||||
ChanReserve: 100,
|
|
||||||
MinHTLC: 400,
|
|
||||||
MaxAcceptedHtlcs: 900,
|
|
||||||
},
|
|
||||||
NetParams: *netParams,
|
NetParams: *netParams,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -458,7 +451,7 @@ func testDualFundingReservationWorkflow(miner *rpctest.Harness,
|
|||||||
require.NoError(t, err, "unable to initialize funding reservation")
|
require.NoError(t, err, "unable to initialize funding reservation")
|
||||||
aliceChanReservation.SetNumConfsRequired(numReqConfs)
|
aliceChanReservation.SetNumConfsRequired(numReqConfs)
|
||||||
channelConstraints := &channeldb.ChannelConstraints{
|
channelConstraints := &channeldb.ChannelConstraints{
|
||||||
DustLimit: alice.Cfg.DefaultConstraints.DustLimit,
|
DustLimit: lnwallet.DustLimitUnknownWitness(),
|
||||||
ChanReserve: fundingAmount / 100,
|
ChanReserve: fundingAmount / 100,
|
||||||
MaxPendingAmount: lnwire.NewMSatFromSatoshis(fundingAmount),
|
MaxPendingAmount: lnwire.NewMSatFromSatoshis(fundingAmount),
|
||||||
MinHTLC: 1,
|
MinHTLC: 1,
|
||||||
@ -863,7 +856,7 @@ func testSingleFunderReservationWorkflow(miner *rpctest.Harness,
|
|||||||
require.NoError(t, err, "unable to init channel reservation")
|
require.NoError(t, err, "unable to init channel reservation")
|
||||||
aliceChanReservation.SetNumConfsRequired(numReqConfs)
|
aliceChanReservation.SetNumConfsRequired(numReqConfs)
|
||||||
channelConstraints := &channeldb.ChannelConstraints{
|
channelConstraints := &channeldb.ChannelConstraints{
|
||||||
DustLimit: alice.Cfg.DefaultConstraints.DustLimit,
|
DustLimit: lnwallet.DustLimitUnknownWitness(),
|
||||||
ChanReserve: fundingAmt / 100,
|
ChanReserve: fundingAmt / 100,
|
||||||
MaxPendingAmount: lnwire.NewMSatFromSatoshis(fundingAmt),
|
MaxPendingAmount: lnwire.NewMSatFromSatoshis(fundingAmt),
|
||||||
MinHTLC: 1,
|
MinHTLC: 1,
|
||||||
|
@ -1363,7 +1363,8 @@ func (l *LightningWallet) initOurContribution(reservation *ChannelReservation,
|
|||||||
)
|
)
|
||||||
|
|
||||||
reservation.partialState.RevocationProducer = producer
|
reservation.partialState.RevocationProducer = producer
|
||||||
reservation.ourContribution.ChannelConstraints = l.Cfg.DefaultConstraints
|
reservation.ourContribution.ChannelConstraints.DustLimit =
|
||||||
|
DustLimitUnknownWitness()
|
||||||
|
|
||||||
// If taproot channels are active, then we'll generate our verification
|
// If taproot channels are active, then we'll generate our verification
|
||||||
// nonce here. We'll use this nonce to verify the signature for our
|
// nonce here. We'll use this nonce to verify the signature for our
|
||||||
|
Loading…
x
Reference in New Issue
Block a user