htlcswitch+lnwallet: remove PaymentDescriptor from ReceiveRevocation returns

This is part of a systematic removal of PaymentDescriptor from the public
API of the lnwallet package. This marks the last change needed before we
make the PaymentDescriptor structure private.
This commit is contained in:
Keagan McClelland committed 2024-09-09 20:59:22 -06:00
1 parent 1ae5705954
commit 957557a937
7 files changed
+120 -114

No files matched your search

+84 -66
View File
@@ -132,7 +132,7 @@ func testAddSettleWorkflow(t *testing.T, tweakless bool,
// Alice then processes this revocation, sending her own revocation for
// her prior commitment transaction. Alice shouldn't have any HTLCs to
// forward since she's sending an outgoing HTLC.
fwdPkg, _, _, _, err := aliceChannel.ReceiveRevocation(bobRevocation)
fwdPkg, _, err := aliceChannel.ReceiveRevocation(bobRevocation)
require.NoError(t, err, "alice unable to process bob's revocation")
if len(fwdPkg.Adds) != 0 {
t.Fatalf("alice forwards %v add htlcs, should forward none",
@@ -157,7 +157,7 @@ func testAddSettleWorkflow(t *testing.T, tweakless bool,
// is fully locked in within both commitment transactions. Bob should
// also be able to forward an HTLC now that the HTLC has been locked
// into both commitment transactions.
fwdPkg, _, _, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
fwdPkg, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
require.NoError(t, err, "bob unable to process alice's revocation")
if len(fwdPkg.Adds) != 1 {
t.Fatalf("bob forwards %v add htlcs, should only forward one",
@@ -249,7 +249,7 @@ func testAddSettleWorkflow(t *testing.T, tweakless bool,
aliceNewCommit, err = aliceChannel.SignNextCommitment()
require.NoError(t, err, "alice unable to sign new commitment")
fwdPkg, _, _, _, err = bobChannel.ReceiveRevocation(aliceRevocation2)
fwdPkg, _, err = bobChannel.ReceiveRevocation(aliceRevocation2)
require.NoError(t, err, "bob unable to process alice's revocation")
if len(fwdPkg.Adds) != 0 {
t.Fatalf("bob forwards %v add htlcs, should forward none",
@@ -286,7 +286,7 @@ func testAddSettleWorkflow(t *testing.T, tweakless bool,
}
}
fwdPkg, _, _, _, err = aliceChannel.ReceiveRevocation(bobRevocation2)
fwdPkg, _, err = aliceChannel.ReceiveRevocation(bobRevocation2)
require.NoError(t, err, "alice unable to process bob's revocation")
if len(fwdPkg.Adds) != 0 {
// Alice should now be able to forward the settlement HTLC to
@@ -468,7 +468,7 @@ func TestChannelZeroAddLocalHeight(t *testing.T) {
aliceRevocation, _, _, err := aliceChannel.RevokeCurrentCommitment()
require.NoError(t, err)
_, _, _, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
_, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
require.NoError(t, err)
// We now restore Alice's channel as this was the point at which
@@ -644,7 +644,7 @@ func testCommitHTLCSigTieBreak(t *testing.T, restart bool) {
bobRevocation, _, _, err := bobChannel.RevokeCurrentCommitment()
require.NoError(t, err, "unable to revoke bob's commitment")
_, _, _, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
_, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
require.NoError(t, err, "unable to receive bob's revocation")
// Now have Bob initiate the second half of the commitment dance. Here
@@ -2556,7 +2556,7 @@ func TestUpdateFeeSenderCommits(t *testing.T) {
// Alice receives the revocation of the old one, and can now assume
// that Bob's received everything up to the signature she sent,
// including the HTLC and fee update.
_, _, _, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
_, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
require.NoError(t, err, "alice unable to process bob's revocation")
// Alice receives new signature from Bob, and assumes this covers the
@@ -2584,7 +2584,7 @@ func TestUpdateFeeSenderCommits(t *testing.T) {
}
// Bob receives revocation from Alice.
_, _, _, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
_, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
require.NoError(t, err, "bob unable to process alice's revocation")
}
@@ -2644,7 +2644,7 @@ func TestUpdateFeeReceiverCommits(t *testing.T) {
require.NoError(t, err, "unable to generate bob revocation")
// Bob receives the revocation of the old commitment
_, _, _, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
_, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
require.NoError(t, err, "alice unable to process bob's revocation")
// Alice will sign next commitment. Since she sent the revocation, she
@@ -2685,7 +2685,7 @@ func TestUpdateFeeReceiverCommits(t *testing.T) {
// Alice receives revocation from Bob, and can now be sure that Bob
// received the two updates, and they are considered locked in.
_, _, _, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
_, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
require.NoError(t, err, "bob unable to process alice's revocation")
// Alice will receive the signature from Bob, which will cover what was
@@ -2713,7 +2713,7 @@ func TestUpdateFeeReceiverCommits(t *testing.T) {
}
// Bob receives revocation from Alice.
_, _, _, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
_, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
require.NoError(t, err, "bob unable to process alice's revocation")
}
@@ -2822,7 +2822,7 @@ func TestUpdateFeeMultipleUpdates(t *testing.T) {
// Alice receives the revocation of the old one, and can now assume that
// Bob's received everything up to the signature she sent, including the
// HTLC and fee update.
_, _, _, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
_, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
require.NoError(t, err, "alice unable to process bob's revocation")
// Alice receives new signature from Bob, and assumes this covers the
@@ -2852,7 +2852,7 @@ func TestUpdateFeeMultipleUpdates(t *testing.T) {
}
// Bob receives revocation from Alice.
_, _, _, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
_, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
require.NoError(t, err, "bob unable to process alice's revocation")
}
@@ -3267,13 +3267,13 @@ func testChanSyncOweCommitment(t *testing.T, chanType channeldb.ChannelType) {
require.NoError(t, err, "unable to revoke bob commitment")
bobNewCommit, err := bobChannel.SignNextCommitment()
require.NoError(t, err, "bob unable to sign commitment")
_, _, _, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
_, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
require.NoError(t, err, "alice unable to recv revocation")
err = aliceChannel.ReceiveNewCommitment(bobNewCommit.CommitSigs)
require.NoError(t, err, "alice unable to rev bob's commitment")
aliceRevocation, _, _, err := aliceChannel.RevokeCurrentCommitment()
require.NoError(t, err, "alice unable to revoke commitment")
_, _, _, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
_, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
require.NoError(t, err, "bob unable to recv revocation")
// At this point, we'll now assert that their log states are what we
@@ -3466,7 +3466,7 @@ func testChanSyncOweCommitmentPendingRemote(t *testing.T,
t.Fatalf("unable to revoke commitment: %v", err)
}
_, _, _, _, err = aliceChannel.ReceiveRevocation(bobRevoke)
_, _, err = aliceChannel.ReceiveRevocation(bobRevoke)
if err != nil {
t.Fatalf("unable to revoke commitment: %v", err)
}
@@ -3502,7 +3502,7 @@ func testChanSyncOweCommitmentPendingRemote(t *testing.T,
if err != nil {
t.Fatal(err)
}
_, _, _, _, err = bobChannel.ReceiveRevocation(aliceRevoke)
_, _, err = bobChannel.ReceiveRevocation(aliceRevoke)
if err != nil {
t.Fatal(err)
}
@@ -3603,7 +3603,7 @@ func testChanSyncOweRevocation(t *testing.T, chanType channeldb.ChannelType) {
bobNewCommit, err := bobChannel.SignNextCommitment()
require.NoError(t, err, "bob unable to sign commitment")
_, _, _, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
_, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
require.NoError(t, err, "alice unable to recv revocation")
err = aliceChannel.ReceiveNewCommitment(bobNewCommit.CommitSigs)
require.NoError(t, err, "alice unable to rev bob's commitment")
@@ -3698,7 +3698,7 @@ func testChanSyncOweRevocation(t *testing.T, chanType channeldb.ChannelType) {
// We'll continue by then allowing bob to process Alice's revocation
// message.
_, _, _, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
_, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
require.NoError(t, err, "bob unable to recv revocation")
// Finally, Alice will add an HTLC over her own such that we assert the
@@ -3916,13 +3916,13 @@ func testChanSyncOweRevocationAndCommit(t *testing.T,
// We'll now finish the state transition by having Alice process both
// messages, and send her final revocation.
_, _, _, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
_, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
require.NoError(t, err, "alice unable to recv revocation")
err = aliceChannel.ReceiveNewCommitment(bobNewCommit.CommitSigs)
require.NoError(t, err, "alice unable to recv bob's commitment")
aliceRevocation, _, _, err := aliceChannel.RevokeCurrentCommitment()
require.NoError(t, err, "alice unable to revoke commitment")
_, _, _, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
_, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
require.NoError(t, err, "bob unable to recv revocation")
}
@@ -4016,7 +4016,7 @@ func testChanSyncOweRevocationAndCommitForceTransition(t *testing.T,
// local commit chain getting height > remote commit chain.
aliceRevocation, _, _, err := aliceChannel.RevokeCurrentCommitment()
require.NoError(t, err, "alice unable to revoke commitment")
_, _, _, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
_, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
require.NoError(t, err, "bob unable to recv revocation")
// Next, Alice will settle that incoming HTLC, then we'll start the
@@ -4148,7 +4148,7 @@ func testChanSyncOweRevocationAndCommitForceTransition(t *testing.T,
// Now, we'll continue the exchange, sending Bob's revocation and
// signature message to Alice, ending with Alice sending her revocation
// message to Bob.
_, _, _, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
_, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
require.NoError(t, err, "alice unable to recv revocation")
err = aliceChannel.ReceiveNewCommitment(&CommitSigs{
CommitSig: bobSigMsg.CommitSig,
@@ -4158,7 +4158,7 @@ func testChanSyncOweRevocationAndCommitForceTransition(t *testing.T,
require.NoError(t, err, "alice unable to rev bob's commitment")
aliceRevocation, _, _, err = aliceChannel.RevokeCurrentCommitment()
require.NoError(t, err, "alice unable to revoke commitment")
_, _, _, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
_, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
require.NoError(t, err, "bob unable to recv revocation")
}
@@ -4584,13 +4584,13 @@ func TestChannelRetransmissionFeeUpdate(t *testing.T) {
require.NoError(t, err, "unable to revoke bob commitment")
bobNewCommit, err := bobChannel.SignNextCommitment()
require.NoError(t, err, "bob unable to sign commitment")
_, _, _, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
_, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
require.NoError(t, err, "alice unable to recv revocation")
err = aliceChannel.ReceiveNewCommitment(bobNewCommit.CommitSigs)
require.NoError(t, err, "alice unable to rev bob's commitment")
aliceRevocation, _, _, err := aliceChannel.RevokeCurrentCommitment()
require.NoError(t, err, "alice unable to revoke commitment")
_, _, _, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
_, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
require.NoError(t, err, "bob unable to recv revocation")
// Both parties should now have the latest fee rate locked-in.
@@ -4782,13 +4782,13 @@ func TestFeeUpdateOldDiskFormat(t *testing.T) {
require.NoError(t, err, "unable to revoke bob commitment")
bobNewCommitSigs, err := bobChannel.SignNextCommitment()
require.NoError(t, err, "bob unable to sign commitment")
_, _, _, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
_, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
require.NoError(t, err, "alice unable to recv revocation")
err = aliceChannel.ReceiveNewCommitment(bobNewCommitSigs.CommitSigs)
require.NoError(t, err, "alice unable to rev bob's commitment")
aliceRevocation, _, _, err := aliceChannel.RevokeCurrentCommitment()
require.NoError(t, err, "alice unable to revoke commitment")
_, _, _, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
_, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
require.NoError(t, err, "bob unable to recv revocation")
// Both parties should now have the latest fee rate locked-in.
@@ -5497,7 +5497,7 @@ func TestLockedInHtlcForwardingSkipAfterRestart(t *testing.T) {
}
// Alice should detect that she doesn't need to forward any HTLC's.
fwdPkg, _, _, _, err := aliceChannel.ReceiveRevocation(bobRevocation)
fwdPkg, _, err := aliceChannel.ReceiveRevocation(bobRevocation)
if err != nil {
t.Fatal(err)
}
@@ -5528,7 +5528,7 @@ func TestLockedInHtlcForwardingSkipAfterRestart(t *testing.T) {
// Bob should now detect that he now has 2 incoming HTLC's that he can
// forward along.
fwdPkg, _, _, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
fwdPkg, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
if err != nil {
t.Fatal(err)
}
@@ -5573,7 +5573,7 @@ func TestLockedInHtlcForwardingSkipAfterRestart(t *testing.T) {
// At this point, Bob receives the revocation from Alice, which is now
// his signal to examine all the HTLC's that have been locked in to
// process.
fwdPkg, _, _, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
fwdPkg, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
if err != nil {
t.Fatal(err)
}
@@ -5622,22 +5622,31 @@ func TestLockedInHtlcForwardingSkipAfterRestart(t *testing.T) {
// Alice should detect that she doesn't need to forward any Adds's, but
// that the Fail has been locked in an can be forwarded.
_, adds, settleFails, _, err := aliceChannel.ReceiveRevocation(bobRevocation)
fwdPkg, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
if err != nil {
t.Fatal(err)
}
adds := fwdPkg.Adds
settleFails := fwdPkg.SettleFails
if len(adds) != 0 {
t.Fatalf("alice shouldn't forward any HTLC's, instead wants to "+
"forward %v htlcs", len(adds))
"forward %v htlcs", len(fwdPkg.Adds))
}
if len(settleFails) != 1 {
t.Fatalf("alice should only forward %d HTLC's, instead wants to "+
"forward %v htlcs", 1, len(settleFails))
"forward %v htlcs", 1, len(fwdPkg.SettleFails))
}
if settleFails[0].ParentIndex != htlc.ID {
fail, ok := settleFails[0].UpdateMsg.(*lnwire.UpdateFailHTLC)
if !ok {
t.Fatalf("expected UpdateFailHTLC, got %T",
settleFails[0].UpdateMsg)
}
if fail.ID != htlc.ID {
t.Fatalf("alice should forward fail for htlcid=%d, instead "+
"forwarding id=%d", htlc.ID,
settleFails[0].ParentIndex)
fail.ID)
}
// We'll now restart both Alice and Bob. This emulates a reconnection
@@ -5671,7 +5680,7 @@ func TestLockedInHtlcForwardingSkipAfterRestart(t *testing.T) {
// Alice should detect that she doesn't need to forward any HTLC's, as
// the updates haven't been committed by Bob yet.
fwdPkg, _, _, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
fwdPkg, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
if err != nil {
t.Fatal(err)
}
@@ -5702,7 +5711,7 @@ func TestLockedInHtlcForwardingSkipAfterRestart(t *testing.T) {
// Bob should detect that he has nothing to forward, as he hasn't
// received any HTLCs.
fwdPkg, _, _, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
fwdPkg, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
if err != nil {
t.Fatal(err)
}
@@ -5732,10 +5741,13 @@ func TestLockedInHtlcForwardingSkipAfterRestart(t *testing.T) {
// When Alice receives the revocation, she should detect that she
// can now forward the freshly locked-in Fail.
_, adds, settleFails, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
fwdPkg, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
if err != nil {
t.Fatal(err)
}
adds = fwdPkg.Adds
settleFails = fwdPkg.SettleFails
if len(adds) != 0 {
t.Fatalf("alice shouldn't forward any HTLC's, instead wants to "+
"forward %v htlcs", len(adds))
@@ -5744,10 +5756,16 @@ func TestLockedInHtlcForwardingSkipAfterRestart(t *testing.T) {
t.Fatalf("alice should only forward one HTLC, instead wants to "+
"forward %v htlcs", len(settleFails))
}
if settleFails[0].ParentIndex != htlc2.ID {
fail, ok = settleFails[0].UpdateMsg.(*lnwire.UpdateFailHTLC)
if !ok {
t.Fatalf("expected UpdateFailHTLC, got %T",
settleFails[0].UpdateMsg)
}
if fail.ID != htlc2.ID {
t.Fatalf("alice should forward fail for htlcid=%d, instead "+
"forwarding id=%d", htlc2.ID,
settleFails[0].ParentIndex)
fail.ID)
}
}
@@ -6347,13 +6365,13 @@ func TestMaxAsynchronousHtlcs(t *testing.T) {
bobRevocation, _, _, err := bobChannel.RevokeCurrentCommitment()
require.NoError(t, err, "unable to revoke revocation")
_, _, _, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
_, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
require.NoError(t, err, "unable to receive revocation")
aliceRevocation, _, _, err := aliceChannel.RevokeCurrentCommitment()
require.NoError(t, err, "unable to revoke revocation")
_, _, _, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
_, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
require.NoError(t, err, "unable to receive revocation")
// Send the final Add which should succeed as in step 6.
@@ -7035,7 +7053,7 @@ func TestChannelRestoreUpdateLogs(t *testing.T) {
// sent. However her local commitment chain still won't include the
// state with the HTLC, since she hasn't received a new commitment
// signature from Bob yet.
_, _, _, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
_, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
require.NoError(t, err, "unable to receive revocation")
// Now make Alice send and sign an additional HTLC. We don't let Bob
@@ -7211,7 +7229,7 @@ func TestChannelRestoreUpdateLogsFailedHTLC(t *testing.T) {
aliceRevocation, _, _, err := aliceChannel.RevokeCurrentCommitment()
require.NoError(t, err, "unable to revoke commitment")
_, _, _, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
_, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
require.NoError(t, err, "bob unable to process alice's revocation")
// At this point Alice has advanced her local commitment chain to a
@@ -7241,7 +7259,7 @@ func TestChannelRestoreUpdateLogsFailedHTLC(t *testing.T) {
// the corresponding Fail from the local update log.
bobRevocation, _, _, err := bobChannel.RevokeCurrentCommitment()
require.NoError(t, err, "unable to revoke commitment")
_, _, _, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
_, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
require.NoError(t, err, "unable to receive revocation")
assertInLogs(t, aliceChannel, 0, 0, 0, 0)
@@ -7466,7 +7484,7 @@ func TestChannelRestoreCommitHeight(t *testing.T) {
bobChannel = restoreAndAssertCommitHeights(t, bobChannel, true, 0, 1, 0)
// Alice receives the revocation, ACKing her pending commitment.
_, _, _, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
_, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
require.NoError(t, err, "unable to receive revocation")
// However, the HTLC is still not locked into her local commitment, so
@@ -7495,7 +7513,7 @@ func TestChannelRestoreCommitHeight(t *testing.T) {
t, aliceChannel, false, 0, 1, 1,
)
_, _, _, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
_, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
require.NoError(t, err, "unable to receive revocation")
// Alice ACKing Bob's pending commitment shouldn't change the heights
@@ -7540,7 +7558,7 @@ func TestChannelRestoreCommitHeight(t *testing.T) {
bobChannel = restoreAndAssertCommitHeights(t, bobChannel, true, 1, 2, 0)
// Alice receives the revocation, ACKing her pending commitment for Bob.
_, _, _, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
_, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
require.NoError(t, err, "unable to receive revocation")
// Alice receiving Bob's revocation should bump both addCommitHeightRemote
@@ -7578,7 +7596,7 @@ func TestChannelRestoreCommitHeight(t *testing.T) {
// Bob receives the revocation, which should set both addCommitHeightRemote
// fields to 2.
_, _, _, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
_, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
require.NoError(t, err, "unable to receive revocation")
bobChannel = restoreAndAssertCommitHeights(t, bobChannel, true, 0, 2, 2)
@@ -7681,7 +7699,7 @@ func TestForceCloseBorkedState(t *testing.T) {
// At this point, all channel mutating methods should now fail as they
// shouldn't be able to proceed if the channel is borked.
_, _, _, _, err = aliceChannel.ReceiveRevocation(revokeMsg)
_, _, err = aliceChannel.ReceiveRevocation(revokeMsg)
if err != channeldb.ErrChanBorked {
t.Fatalf("advance commitment tail should have failed")
}
@@ -9477,7 +9495,7 @@ func TestChannelUnsignedAckedFailure(t *testing.T) {
// -----rev----->
aliceRevocation, _, _, err := aliceChannel.RevokeCurrentCommitment()
require.NoError(t, err)
_, _, _, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
_, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
require.NoError(t, err)
// Alice should sign the next commitment and go down before
@@ -9502,7 +9520,7 @@ func TestChannelUnsignedAckedFailure(t *testing.T) {
// <----rev------
bobRevocation, _, _, err := bobChannel.RevokeCurrentCommitment()
require.NoError(t, err)
_, _, _, _, err = newAliceChannel.ReceiveRevocation(bobRevocation)
_, _, err = newAliceChannel.ReceiveRevocation(bobRevocation)
require.NoError(t, err)
// Now Bob sends an HTLC to Alice.
@@ -9588,7 +9606,7 @@ func TestChannelLocalUnsignedUpdatesFailure(t *testing.T) {
// <----rev-----
bobRevocation, _, _, err := bobChannel.RevokeCurrentCommitment()
require.NoError(t, err)
_, _, _, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
_, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
require.NoError(t, err)
// Restart Alice and assert that she can receive Bob's next commitment
@@ -9672,7 +9690,7 @@ func TestChannelSignedAckRegression(t *testing.T) {
// <----rev-----
bobRevocation, _, _, err := bobChannel.RevokeCurrentCommitment()
require.NoError(t, err)
_, _, _, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
_, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
require.NoError(t, err)
// <----sig-----
@@ -9699,7 +9717,7 @@ func TestChannelSignedAckRegression(t *testing.T) {
// <----rev-----
bobRevocation, _, _, err = bobChannel.RevokeCurrentCommitment()
require.NoError(t, err)
_, _, _, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
_, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
require.NoError(t, err)
// Restart Bob's channel state here.
@@ -9712,7 +9730,7 @@ func TestChannelSignedAckRegression(t *testing.T) {
// -----rev---->
aliceRevocation, _, _, err := aliceChannel.RevokeCurrentCommitment()
require.NoError(t, err)
fwdPkg, _, _, _, err := newBobChannel.ReceiveRevocation(aliceRevocation)
fwdPkg, _, err := newBobChannel.ReceiveRevocation(aliceRevocation)
require.NoError(t, err)
// Assert that the fwdpkg is not empty.
@@ -9804,7 +9822,7 @@ func TestIsChannelClean(t *testing.T) {
// <---rev---
bobRevocation, _, _, err := bobChannel.RevokeCurrentCommitment()
require.NoError(t, err)
_, _, _, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
_, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
require.NoError(t, err)
assertCleanOrDirty(false, aliceChannel, bobChannel, t)
@@ -9818,7 +9836,7 @@ func TestIsChannelClean(t *testing.T) {
// ---rev--->
aliceRevocation, _, _, err := aliceChannel.RevokeCurrentCommitment()
require.NoError(t, err)
_, _, _, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
_, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
require.NoError(t, err)
assertCleanOrDirty(false, aliceChannel, bobChannel, t)
@@ -9839,7 +9857,7 @@ func TestIsChannelClean(t *testing.T) {
// ---rev--->
aliceRevocation, _, _, err = aliceChannel.RevokeCurrentCommitment()
require.NoError(t, err)
_, _, _, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
_, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
require.NoError(t, err)
assertCleanOrDirty(false, aliceChannel, bobChannel, t)
@@ -9853,7 +9871,7 @@ func TestIsChannelClean(t *testing.T) {
// <---rev---
bobRevocation, _, _, err = bobChannel.RevokeCurrentCommitment()
require.NoError(t, err)
_, _, _, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
_, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
require.NoError(t, err)
assertCleanOrDirty(true, aliceChannel, bobChannel, t)
@@ -9877,7 +9895,7 @@ func TestIsChannelClean(t *testing.T) {
// <---rev---
bobRevocation, _, _, err = bobChannel.RevokeCurrentCommitment()
require.NoError(t, err)
_, _, _, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
_, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
require.NoError(t, err)
assertCleanOrDirty(false, aliceChannel, bobChannel, t)
@@ -9892,7 +9910,7 @@ func TestIsChannelClean(t *testing.T) {
// ---rev--->
aliceRevocation, _, _, err = aliceChannel.RevokeCurrentCommitment()
require.NoError(t, err)
_, _, _, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
_, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
require.NoError(t, err)
assertCleanOrDirty(true, aliceChannel, bobChannel, t)
}
@@ -10035,7 +10053,7 @@ func testGetDustSum(t *testing.T, chantype channeldb.ChannelType) {
// dust.
bobRevocation, _, _, err := bobChannel.RevokeCurrentCommitment()
require.NoError(t, err)
_, _, _, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
_, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
require.NoError(t, err)
checkDust(aliceChannel, htlc2Amt, htlc2Amt)
checkDust(bobChannel, htlc2Amt, htlc2Amt)
@@ -10048,7 +10066,7 @@ func testGetDustSum(t *testing.T, chantype channeldb.ChannelType) {
require.NoError(t, err)
aliceRevocation, _, _, err := aliceChannel.RevokeCurrentCommitment()
require.NoError(t, err)
_, _, _, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
_, _, err = bobChannel.ReceiveRevocation(aliceRevocation)
require.NoError(t, err)
checkDust(aliceChannel, htlc2Amt, htlc2Amt)
checkDust(bobChannel, htlc2Amt, htlc2Amt)
@@ -11008,7 +11026,7 @@ func TestAsynchronousSendingWithFeeBuffer(t *testing.T) {
bobRevocation, _, _, err := bobChannel.RevokeCurrentCommitment()
require.NoError(t, err)
_, _, _, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
_, _, err = aliceChannel.ReceiveRevocation(bobRevocation)
require.NoError(t, err)
// Before testing the behavior of the fee buffer, we are going to fail