mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-11-10 14:17:56 +01:00
brontide/noise: use statically allocated prologue
This commit is contained in:
@@ -47,6 +47,10 @@ var (
|
|||||||
// the cipher session exceeds the maximum allowed message payload.
|
// the cipher session exceeds the maximum allowed message payload.
|
||||||
ErrMaxMessageLengthExceeded = errors.New("the generated payload exceeds " +
|
ErrMaxMessageLengthExceeded = errors.New("the generated payload exceeds " +
|
||||||
"the max allowed message length of (2^16)-1")
|
"the max allowed message length of (2^16)-1")
|
||||||
|
|
||||||
|
// lightningPrologue is the noise prologue that is used to initialize
|
||||||
|
// the brontide noise handshake.
|
||||||
|
lightningPrologue = []byte("lightning")
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO(roasbeef): free buffer pool?
|
// TODO(roasbeef): free buffer pool?
|
||||||
@@ -377,8 +381,9 @@ type Machine struct {
|
|||||||
func NewBrontideMachine(initiator bool, localPub *btcec.PrivateKey,
|
func NewBrontideMachine(initiator bool, localPub *btcec.PrivateKey,
|
||||||
remotePub *btcec.PublicKey, options ...func(*Machine)) *Machine {
|
remotePub *btcec.PublicKey, options ...func(*Machine)) *Machine {
|
||||||
|
|
||||||
handshake := newHandshakeState(initiator, []byte("lightning"), localPub,
|
handshake := newHandshakeState(
|
||||||
remotePub)
|
initiator, lightningPrologue, localPub, remotePub,
|
||||||
|
)
|
||||||
|
|
||||||
m := &Machine{handshakeState: handshake}
|
m := &Machine{handshakeState: handshake}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user