channeldb+migration: export commonly used methods

This commit exports several commonly used methods that can be used by
later migrations. It also adds a channel commit deserializer.
This commit is contained in:
yyforyongyu committed 2022-04-20 01:18:12 +08:00
1 parent 22f8f6ed4a
commit 8b289e79f5
7 files changed
+109 -20

No files matched your search

+2 -2
View File
@@ -70,7 +70,7 @@ func MigrateFwdPkgCleanup(tx kvdb.RwTx) error {
// Iterate over all close channels and remove their forwarding packages.
for _, summery := range chanSummaries {
sourceBytes := makeLogKey(summery.ShortChanID.ToUint64())
sourceBytes := MakeLogKey(summery.ShortChanID.ToUint64())
// First, we will try to find the corresponding bucket. If there
// is not a nested bucket matching the ShortChanID, we will skip
@@ -112,7 +112,7 @@ func deserializeCloseChannelSummary(
}
// makeLogKey converts a uint64 into an 8 byte array.
func makeLogKey(updateNum uint64) [8]byte {
func MakeLogKey(updateNum uint64) [8]byte {
var key [8]byte
binary.BigEndian.PutUint64(key[:], updateNum)
return key