Merge pull request #3992 from joostjager/restore-update-fix
lnwallet: fix invalid value use in restoreUpdate
This commit is contained in:
commit
2c08a8b9a8
@ -1064,7 +1064,7 @@ func (u *updateLog) appendUpdate(pd *PaymentDescriptor) {
|
|||||||
// also added to index accordingly. This function differs from appendUpdate in
|
// also added to index accordingly. This function differs from appendUpdate in
|
||||||
// that it won't increment the log index counter.
|
// that it won't increment the log index counter.
|
||||||
func (u *updateLog) restoreUpdate(pd *PaymentDescriptor) {
|
func (u *updateLog) restoreUpdate(pd *PaymentDescriptor) {
|
||||||
u.updateIndex[u.logIndex] = u.PushBack(pd)
|
u.updateIndex[pd.LogIndex] = u.PushBack(pd)
|
||||||
}
|
}
|
||||||
|
|
||||||
// appendHtlc appends a new HTLC offer to the tip of the update log. The entry
|
// appendHtlc appends a new HTLC offer to the tip of the update log. The entry
|
||||||
|
@ -3146,7 +3146,7 @@ func TestChanSyncOweCommitmentPendingRemote(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Bob signs the commitment he owes.
|
// Bob signs the commitment he owes.
|
||||||
_, bobHtlcSigs, _, err := bobChannel.SignNextCommitment()
|
bobCommit, bobHtlcSigs, _, err := bobChannel.SignNextCommitment()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to sign commitment: %v", err)
|
t.Fatalf("unable to sign commitment: %v", err)
|
||||||
}
|
}
|
||||||
@ -3155,6 +3155,20 @@ func TestChanSyncOweCommitmentPendingRemote(t *testing.T) {
|
|||||||
if len(bobHtlcSigs) != 0 {
|
if len(bobHtlcSigs) != 0 {
|
||||||
t.Fatalf("no htlcs expected, but got %v", len(bobHtlcSigs))
|
t.Fatalf("no htlcs expected, but got %v", len(bobHtlcSigs))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get Alice to revoke and trigger Bob to compact his logs.
|
||||||
|
err = aliceChannel.ReceiveNewCommitment(bobCommit, bobHtlcSigs)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
aliceRevoke, _, err := aliceChannel.RevokeCurrentCommitment()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
_, _, _, _, err = bobChannel.ReceiveRevocation(aliceRevoke)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestChanSyncOweRevocation tests that if Bob restarts (and then Alice) before
|
// TestChanSyncOweRevocation tests that if Bob restarts (and then Alice) before
|
||||||
|
Loading…
Reference in New Issue
Block a user