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:
Conner Fromknecht 2018-07-27 02:20:53 -07:00
parent 81778664a7
commit af6c4e5174
No known key found for this signature in database
GPG Key ID: E7D737B67FA592C7

@ -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 {
var key [8]byte
byteOrder.PutUint64(key[:], updateNum)
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,
commit *ChannelCommitment) error {