chanbackup: refuse to start the SubSwapper if we can't read the SCB file

In this commit, we add an additional defense against starting up with an
invalid SCB state. With this commit, we'll now fail to start up if we're
unable to update or read the existing SCB state from disk. This will
prevent an lnd node from starting up with an invalid SCB file, an SCB
file it can't decrypt, or an SCB left over from another node.
This commit is contained in:
Olaoluwa Osuntokun
2020-06-15 17:41:44 -07:00
parent fc65c9b2cc
commit 496e29d02e
2 changed files with 19 additions and 11 deletions

View File

@ -21,7 +21,7 @@ type mockSwapper struct {
func newMockSwapper(keychain keychain.KeyRing) *mockSwapper {
return &mockSwapper{
swaps: make(chan PackedMulti),
swaps: make(chan PackedMulti, 1),
keyChain: keychain,
swapState: &Multi{},
}