mirror of
https://github.com/aljazceru/breez-lnd.git
synced 2025-12-17 22:24:21 +01:00
lnwallet: restore unsigned acked remote updates
This commit updates the channel state machine to persistently store remote updates that we have received a signature for, but that we haven't yet included in a commit signature of our own. Previously those updates were only stored in memory and dropped across restarts. This lead to the production of an invalid signature and channel force closure. The remote party expects us to include those updates.
This commit is contained in:
@@ -3151,10 +3151,9 @@ func TestChanSyncOweCommitmentPendingRemote(t *testing.T) {
|
||||
t.Fatalf("unable to sign commitment: %v", err)
|
||||
}
|
||||
|
||||
// This commitment is expected to contain no htlcs anymore, but because
|
||||
// of a bug it is still present. THIS IS NOT CORRECT!
|
||||
if len(bobHtlcSigs) != 2 {
|
||||
t.Fatal("expected htlc to still be pending")
|
||||
// This commitment is expected to contain no htlcs anymore.
|
||||
if len(bobHtlcSigs) != 0 {
|
||||
t.Fatalf("no htlcs expected, but got %v", len(bobHtlcSigs))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6289,11 +6288,8 @@ func TestChannelRestoreUpdateLogsFailedHTLC(t *testing.T) {
|
||||
// sent a new signature yet. If we'd now restart and restore, the htlc
|
||||
// failure update should still be waiting for inclusion in Alice's next
|
||||
// signature. Otherwise the produced signature would be invalid.
|
||||
//
|
||||
// THIS IS NOT HAPPENING. The update log entry is dropped after a
|
||||
// restart!
|
||||
assertInLogs(t, aliceChannel, 1, 0, 0, 1)
|
||||
restoreAndAssert(t, aliceChannel, 1, 0, 0, 0)
|
||||
restoreAndAssert(t, aliceChannel, 1, 0, 0, 1)
|
||||
|
||||
// Now send a signature from Alice. This will give Bob a new commitment
|
||||
// where the HTLC is removed.
|
||||
|
||||
Reference in New Issue
Block a user