lnwallet: introduce GetDustSum method to calculate worst-case dust sum

It over-estimates the local or remote commitment's dust sum by
counting all updates in both updateLogs that are dust using the
trimmed-to-dust mechanism if applicable. The over-estimation is done
because ensuring an accurate counting is a trade-off between code
simplicity and accuracy.
This commit is contained in:
eugene
2021-09-28 11:34:10 -04:00
parent 34cb9357ee
commit 7d16e58b5c
4 changed files with 255 additions and 18 deletions

View File

@ -93,6 +93,9 @@ var (
0xc5, 0x6c, 0xbb, 0xac, 0x46, 0x22, 0x08, 0x22,
0x21, 0xa8, 0x76, 0x8d, 0x1d, 0x09,
}
aliceDustLimit = btcutil.Amount(200)
bobDustLimit = btcutil.Amount(1300)
)
// CreateTestChannels creates to fully populated channels to be used within
@ -112,8 +115,6 @@ func CreateTestChannels(chanType channeldb.ChannelType) (
}
channelBal := channelCapacity / 2
aliceDustLimit := btcutil.Amount(200)
bobDustLimit := btcutil.Amount(1300)
csvTimeoutAlice := uint32(5)
csvTimeoutBob := uint32(4)