channeldb: fix channel corruption bug upon channel closure

This commit fixes a bug which would previously lead to corruption of
the channel state when a node had one or more channels open and one of
them was closed either forcibly or cooperatively. The source of the bug
itself as a typo: rather than using the construed `deliveryKey`
variable to fetch/put/delete the delivery scripts, `deliveryScriptsKey`
(the key prefix itself) as used. This bug would cause the database to
be unable to read _any_ channel from the database after one was
deleted, as each channel would actually be reading/writing-to the
_exact same_ delivery script.

The fix for the bug itself is simple: eliminate the typo.
This commit is contained in:
Olaoluwa Osuntokun committed 2017-02-07 19:54:51 -08:00
1 parent 926f5c84d0
commit e8e53a4b91
2 files changed
+7 -7

No files matched your search

+1 -1
View File
@@ -276,7 +276,7 @@ func (d *DB) fetchNodeChannels(openChanBucket,
nodeChanBucket, chanID)
if err != nil {
return fmt.Errorf("unable to read channel data for "+
"chan_point=%v", chanID)
"chan_point=%v: %v", chanID, err)
}
oChannel.Db = d