lnwallet: add zero-fee-htlc-tx test vectors

This commit is contained in:
Elle Mouton committed 2023-03-16 17:27:05 +02:00
1 parent 6774b72913
commit b607db30f9
2 files changed
+184 -4

No files matched your search

+18 -4
View File
@@ -178,10 +178,11 @@ type htlcDesc struct {
}
type testCase struct {
Name string
LocalBalance lnwire.MilliSatoshi
RemoteBalance lnwire.MilliSatoshi
FeePerKw btcutil.Amount
Name string
LocalBalance lnwire.MilliSatoshi
RemoteBalance lnwire.MilliSatoshi
FeePerKw btcutil.Amount
DustLimitSatoshis btcutil.Amount
// UseTestHtlcs defined whether the fixed set of test htlc should be
// added to the channel before checking the commitment assertions.
@@ -214,6 +215,13 @@ func TestCommitmentAndHTLCTransactions(t *testing.T) {
channeldb.AnchorOutputsBit,
jsonFile: "test_vectors_anchors.json",
},
{
name: "zero fee htlc tx",
chanType: channeldb.SingleFunderTweaklessBit |
channeldb.AnchorOutputsBit |
channeldb.ZeroHtlcTxFeeBit,
jsonFile: "test_vectors_zero_fee_htlc_tx.json",
},
}
for _, set := range vectorSets {
@@ -301,6 +309,12 @@ func testVectors(t *testing.T, chanType channeldb.ChannelType, test testCase) {
testHtlcs = testHtlcsSet2
}
// If the test specifies a dust limit, then use it instead of the
// default.
if test.DustLimitSatoshis != 0 {
tc.dustLimit = test.DustLimitSatoshis
}
// Balances in the test vectors are before subtraction of in-flight
// htlcs. Convert to spendable balances.
remoteBalance := test.RemoteBalance