lnwallet: exports fields related to AnchorChans
This commit is contained in:
1 parent
778c7287b0
commit
fce7fb43ba
1 file changed
+11
-11
+11
-11
@@ -35,18 +35,18 @@ const (
|
|||||||
// outside word.
|
// outside word.
|
||||||
msgBufferSize = 100
|
msgBufferSize = 100
|
||||||
|
|
||||||
// anchorChanReservedValue is the amount we'll keep around in the
|
// AnchorChanReservedValue is the amount we'll keep around in the
|
||||||
// wallet in case we have to fee bump anchor channels on force close.
|
// wallet in case we have to fee bump anchor channels on force close.
|
||||||
// TODO(halseth): update constant to target a specific commit size at
|
// TODO(halseth): update constant to target a specific commit size at
|
||||||
// set fee rate.
|
// set fee rate.
|
||||||
anchorChanReservedValue = btcutil.Amount(10_000)
|
AnchorChanReservedValue = btcutil.Amount(10_000)
|
||||||
|
|
||||||
// maxAnchorChanReservedValue is the maximum value we'll reserve for
|
// MaxAnchorChanReservedValue is the maximum value we'll reserve for
|
||||||
// anchor channel fee bumping. We cap it at 10 times the per-channel
|
// anchor channel fee bumping. We cap it at 10 times the per-channel
|
||||||
// amount such that nodes with a high number of channels don't have to
|
// amount such that nodes with a high number of channels don't have to
|
||||||
// keep around a very large amount for the unlikely scenario that they
|
// keep around a very large amount for the unlikely scenario that they
|
||||||
// all close at the same time.
|
// all close at the same time.
|
||||||
maxAnchorChanReservedValue = 10 * anchorChanReservedValue
|
MaxAnchorChanReservedValue = 10 * AnchorChanReservedValue
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -900,7 +900,7 @@ func (l *LightningWallet) enforceNewReservedValue(fundingIntent chanfunding.Inte
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
numAnchors, err := l.currentNumAnchorChans()
|
numAnchors, err := l.CurrentNumAnchorChans()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -919,9 +919,9 @@ func (l *LightningWallet) enforceNewReservedValue(fundingIntent chanfunding.Inte
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// currentNumAnchorChans returns the current number of non-private anchor
|
// CurrentNumAnchorChans returns the current number of non-private anchor
|
||||||
// channels the wallet should be ready to fee bump if needed.
|
// channels the wallet should be ready to fee bump if needed.
|
||||||
func (l *LightningWallet) currentNumAnchorChans() (int, error) {
|
func (l *LightningWallet) CurrentNumAnchorChans() (int, error) {
|
||||||
// Count all anchor channels that are open or pending
|
// Count all anchor channels that are open or pending
|
||||||
// open, or waiting close.
|
// open, or waiting close.
|
||||||
chans, err := l.Cfg.Database.FetchAllChannels()
|
chans, err := l.Cfg.Database.FetchAllChannels()
|
||||||
@@ -1046,9 +1046,9 @@ func (l *LightningWallet) CheckReservedValue(in []wire.OutPoint,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We reserve a given amount for each anchor channel.
|
// We reserve a given amount for each anchor channel.
|
||||||
reserved := btcutil.Amount(numAnchorChans) * anchorChanReservedValue
|
reserved := btcutil.Amount(numAnchorChans) * AnchorChanReservedValue
|
||||||
if reserved > maxAnchorChanReservedValue {
|
if reserved > MaxAnchorChanReservedValue {
|
||||||
reserved = maxAnchorChanReservedValue
|
reserved = MaxAnchorChanReservedValue
|
||||||
}
|
}
|
||||||
|
|
||||||
if walletBalance < reserved {
|
if walletBalance < reserved {
|
||||||
@@ -1069,7 +1069,7 @@ func (l *LightningWallet) CheckReservedValue(in []wire.OutPoint,
|
|||||||
func (l *LightningWallet) CheckReservedValueTx(req CheckReservedValueTxReq) (
|
func (l *LightningWallet) CheckReservedValueTx(req CheckReservedValueTxReq) (
|
||||||
btcutil.Amount, error) {
|
btcutil.Amount, error) {
|
||||||
|
|
||||||
numAnchors, err := l.currentNumAnchorChans()
|
numAnchors, err := l.CurrentNumAnchorChans()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user