channeldb/channel_test: test packager source updated
This commit is contained in:
parent
fc658dbf60
commit
639c9875b2
@ -898,6 +898,16 @@ func TestRefreshShortChanID(t *testing.T) {
|
|||||||
"updated before refreshing short_chan_id")
|
"updated before refreshing short_chan_id")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Now that the receiver's short channel id has been updated, check to
|
||||||
|
// ensure that the channel packager's source has been updated as well.
|
||||||
|
// This ensures that the packager will read and write to buckets
|
||||||
|
// corresponding to the new short chan id, instead of the prior.
|
||||||
|
if state.Packager.(*ChannelPackager).source != chanOpenLoc {
|
||||||
|
t.Fatalf("channel packager source was not updated: want %v, "+
|
||||||
|
"got %v", chanOpenLoc,
|
||||||
|
state.Packager.(*ChannelPackager).source)
|
||||||
|
}
|
||||||
|
|
||||||
// Now, refresh the short channel ID of the pending channel.
|
// Now, refresh the short channel ID of the pending channel.
|
||||||
err = pendingChannel.RefreshShortChanID()
|
err = pendingChannel.RefreshShortChanID()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -911,4 +921,14 @@ func TestRefreshShortChanID(t *testing.T) {
|
|||||||
"refreshed: want %v, got %v", state.ShortChanID(),
|
"refreshed: want %v, got %v", state.ShortChanID(),
|
||||||
pendingChannel.ShortChanID())
|
pendingChannel.ShortChanID())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check to ensure that the _other_ OpenChannel channel packager's
|
||||||
|
// source has also been updated after the refresh. This ensures that the
|
||||||
|
// other packagers will read and write to buckets corresponding to the
|
||||||
|
// updated short chan id.
|
||||||
|
if pendingChannel.Packager.(*ChannelPackager).source != chanOpenLoc {
|
||||||
|
t.Fatalf("channel packager source was not updated: want %v, "+
|
||||||
|
"got %v", chanOpenLoc,
|
||||||
|
pendingChannel.Packager.(*ChannelPackager).source)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user