channeldb+lnwallet: define zero-fee channel type

This commit is contained in:
Johan T. Halseth committed 2020-12-15 10:13:07 +01:00
1 parent abefa93065
commit d5cd9861d2
2 files changed
+22

No files matched your search

+12
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)
}