mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-27 06:01:48 +02:00
lnwire: encode channel_update type in onion errors
For about a year [1], the spec has prescribed encoding channel_updates with their type prefix (0x0102) in onion failure messages. LND can decode correctly with or without the prefix but hasn't been writing the prefix during encoding. This commit starts writing the prefix. [1] https://github.com/lightning/bolts/pull/979
This commit is contained in:
committed by
Olaoluwa Osuntokun
parent
53b33c75c4
commit
3549e329df
@@ -184,15 +184,15 @@ func TestWriteOnionErrorChanUpdate(t *testing.T) {
|
||||
// raw serialized length.
|
||||
var b bytes.Buffer
|
||||
update := testChannelUpdate
|
||||
if err := update.Encode(&b, 0); err != nil {
|
||||
trueUpdateLength, err := WriteMessage(&b, &update, 0)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to write update: %v", err)
|
||||
}
|
||||
trueUpdateLength := b.Len()
|
||||
|
||||
// Next, we'll use the function to encode the update as we would in a
|
||||
// onion error message.
|
||||
var errorBuf bytes.Buffer
|
||||
err := writeOnionErrorChanUpdate(&errorBuf, &update, 0)
|
||||
err = writeOnionErrorChanUpdate(&errorBuf, &update, 0)
|
||||
require.NoError(t, err, "unable to encode onion error")
|
||||
|
||||
// Finally, read the length encoded and ensure that it matches the raw
|
||||
|
Reference in New Issue
Block a user