mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-05 08:41:42 +02:00
lnwire: replace instances of *btcec.PublicKey with [33]byte in ann messages
In this commit, we replace all instances of *btcec.PublicKey within the announcement messages with a simple [33]byte. We do this as usually we don’t need to immediately validate an announcement, therefore we can avoid the scalar multiplications during decoding.
This commit is contained in:
@@ -201,6 +201,10 @@ func writeElement(w io.Writer, element interface{}) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if _, err := w.Write(e[:]); err != nil {
|
||||
return err
|
||||
}
|
||||
case [33]byte:
|
||||
if _, err := w.Write(e[:]); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -527,6 +531,10 @@ func readElement(r io.Reader, element interface{}) error {
|
||||
if _, err := io.ReadFull(r, *e); err != nil {
|
||||
return err
|
||||
}
|
||||
case *[33]byte:
|
||||
if _, err := io.ReadFull(r, e[:]); err != nil {
|
||||
return err
|
||||
}
|
||||
case []byte:
|
||||
if _, err := io.ReadFull(r, e); err != nil {
|
||||
return err
|
||||
|
Reference in New Issue
Block a user