2019-02-16 04:27:16 +01:00
|
|
|
package buffer
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/lightningnetwork/lnd/lnwire"
|
|
|
|
)
|
|
|
|
|
|
|
|
// ReadSize represents the size of the maximum message that can be read off the
|
|
|
|
// wire by brontide. The buffer is used to hold the ciphertext while the
|
|
|
|
// brontide state machine decrypts the message.
|
2021-06-17 04:49:33 +02:00
|
|
|
const ReadSize = lnwire.MaxSliceLength + 16
|
2019-02-16 04:27:16 +01:00
|
|
|
|
|
|
|
// Read is a static byte array sized to the maximum-allowed Lightning message
|
|
|
|
// size, plus 16 bytes for the MAC.
|
|
|
|
type Read [ReadSize]byte
|
|
|
|
|
|
|
|
// Recycle zeroes the Read, making it fresh for another use.
|
|
|
|
func (b *Read) Recycle() {
|
|
|
|
RecycleSlice(b[:])
|
|
|
|
}
|