channeldb/channel: adds readLogKey for chanids
Adds helper method to parse short chanids used as keys in the forwarding package.
This commit is contained in:
parent
81778664a7
commit
af6c4e5174
@ -2440,12 +2440,20 @@ func deleteOpenChannel(chanBucket *bolt.Bucket, chanPointBytes []byte) error {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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
|
var key [8]byte
|
||||||
byteOrder.PutUint64(key[:], updateNum)
|
byteOrder.PutUint64(key[:], updateNum)
|
||||||
return key
|
return key
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// readLogKey parse the first 8- bytes of a byte slice into a uint64.
|
||||||
|
//
|
||||||
|
// NOTE: The slice must be at least 8 bytes long.
|
||||||
|
func readLogKey(b []byte) uint64 {
|
||||||
|
return byteOrder.Uint64(b)
|
||||||
|
}
|
||||||
|
|
||||||
func appendChannelLogEntry(log *bolt.Bucket,
|
func appendChannelLogEntry(log *bolt.Bucket,
|
||||||
commit *ChannelCommitment) error {
|
commit *ChannelCommitment) error {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user