From f594a242eaefc5cd139926f0851c1327246da14c Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Tue, 27 Mar 2018 17:07:15 -0700 Subject: [PATCH] channeldb/channel_test: test ShortChanID is updated in-mem Modifies TestFetchPendingChannels to verify that calls to MarkAsOpen also modify the in-memory state. Previously we only tested the persistent state loaded immediately after. --- channeldb/channel_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/channeldb/channel_test.go b/channeldb/channel_test.go index 4cf14c78..e405f60d 100644 --- a/channeldb/channel_test.go +++ b/channeldb/channel_test.go @@ -684,6 +684,16 @@ func TestFetchPendingChannels(t *testing.T) { t.Fatalf("unable to mark channel as open: %v", err) } + if pendingChannels[0].IsPending { + t.Fatalf("channel marked open should no longer be pending") + } + + if pendingChannels[0].ShortChanID != chanOpenLoc { + t.Fatalf("channel opening height not updated: expected %v, "+ + "got %v", spew.Sdump(pendingChannels[0].ShortChanID), + chanOpenLoc) + } + // Next, we'll re-fetch the channel to ensure that the open height was // properly set. openChans, err := cdb.FetchAllChannels()