channeldb: refresh channel state within RefreshShortChanID

Refresh channel memory state whenever the short channel id is refreshed.
This is to make the in-memory channel consistent with the disk data.

Fixes #3765.
This commit is contained in:
Roei Erez authored and Olaoluwa Osuntokun committed 2019-11-27 15:10:00 -06:00
1 parent 59c4db7f33
commit 8b3dd9415e
3 files changed
+103 -12

No files matched your search

+8 -2
View File
@@ -939,8 +939,8 @@ func TestFetchWaitingCloseChannels(t *testing.T) {
}
// TestRefreshShortChanID asserts that RefreshShortChanID updates the in-memory
// short channel ID of another OpenChannel to reflect a preceding call to
// MarkOpen on a different OpenChannel.
// state of another OpenChannel to reflect a preceding call to MarkOpen on a
// different OpenChannel.
func TestRefreshShortChanID(t *testing.T) {
t.Parallel()
@@ -1038,4 +1038,10 @@ func TestRefreshShortChanID(t *testing.T) {
"got %v", chanOpenLoc,
pendingChannel.Packager.(*ChannelPackager).source)
}
// Check to ensure that this channel is no longer pending and this field
// is up to date.
if pendingChannel.IsPending {
t.Fatalf("channel pending state wasn't updated: want false got true")
}
}