channeldb+lnwallet: define zero-fee channel type

This commit is contained in:
Johan T. Halseth
2020-12-07 14:14:20 +01:00
parent abefa93065
commit d5cd9861d2
2 changed files with 22 additions and 0 deletions

View File

@@ -278,6 +278,12 @@ func CommitWeight(chanType channeldb.ChannelType) int64 {
func HtlcTimeoutFee(chanType channeldb.ChannelType,
feePerKw chainfee.SatPerKWeight) btcutil.Amount {
// For zero-fee HTLC channels, this will always be zero, regardless of
// feerate.
if chanType.ZeroHtlcTxFee() {
return 0
}
if chanType.HasAnchors() {
return feePerKw.FeeForWeight(input.HtlcTimeoutWeightConfirmed)
}
@@ -290,6 +296,12 @@ func HtlcTimeoutFee(chanType channeldb.ChannelType,
func HtlcSuccessFee(chanType channeldb.ChannelType,
feePerKw chainfee.SatPerKWeight) btcutil.Amount {
// For zero-fee HTLC channels, this will always be zero, regardless of
// feerate.
if chanType.ZeroHtlcTxFee() {
return 0
}
if chanType.HasAnchors() {
return feePerKw.FeeForWeight(input.HtlcSuccessWeightConfirmed)
}