discovery: utilize exactly 9 bytes for serialized waitingProofKey
This commit is contained in:
parent
608b9d96d1
commit
1894a208bd
@ -10,7 +10,7 @@ import (
|
|||||||
"github.com/roasbeef/btcd/btcec"
|
"github.com/roasbeef/btcd/btcec"
|
||||||
)
|
)
|
||||||
|
|
||||||
// newProofKey constructs new announcement signature message key.
|
// newProofKey constructs a new announcement signature message key.
|
||||||
func newProofKey(chanID uint64, isRemote bool) waitingProofKey {
|
func newProofKey(chanID uint64, isRemote bool) waitingProofKey {
|
||||||
return waitingProofKey{
|
return waitingProofKey{
|
||||||
chanID: chanID,
|
chanID: chanID,
|
||||||
@ -18,9 +18,9 @@ func newProofKey(chanID uint64, isRemote bool) waitingProofKey {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToBytes represents the key in the byte format.
|
// ToBytes returns a serialized representation of the key.
|
||||||
func (k waitingProofKey) ToBytes() []byte {
|
func (k waitingProofKey) ToBytes() []byte {
|
||||||
var key [10]byte
|
var key [9]byte
|
||||||
|
|
||||||
var b uint8
|
var b uint8
|
||||||
if k.isRemote {
|
if k.isRemote {
|
||||||
@ -29,8 +29,8 @@ func (k waitingProofKey) ToBytes() []byte {
|
|||||||
b = 1
|
b = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
binary.BigEndian.PutUint64(key[:], k.chanID)
|
binary.BigEndian.PutUint64(key[:8], k.chanID)
|
||||||
key[9] = b
|
key[8] = b
|
||||||
|
|
||||||
return key[:]
|
return key[:]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user