mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-01 18:27:43 +02:00
lnwire: add update_fail_malformed_htlc message
In this commit BOLT#4 specification message have been added to the lnwire package. This messsage is needed in order to notify payment sender that forwarding node unable to parse the onion blob.
This commit is contained in:
committed by
Olaoluwa Osuntokun
parent
98956bc2fe
commit
46ba18db9b
@@ -180,7 +180,10 @@ func writeElement(w io.Writer, element interface{}) error {
|
||||
if _, err := w.Write(e[:]); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
case FailCode:
|
||||
if err := writeElement(w, uint16(e)); err != nil {
|
||||
return err
|
||||
}
|
||||
case ShortChannelID:
|
||||
// Check that field fit in 3 bytes and write the blockHeight
|
||||
if e.BlockHeight > ((1 << 24) - 1) {
|
||||
@@ -440,6 +443,10 @@ func readElement(r io.Reader, element interface{}) error {
|
||||
Hash: *hash,
|
||||
Index: uint32(index),
|
||||
}
|
||||
case *FailCode:
|
||||
if err := readElement(r, (*uint16)(e)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
case *ChannelID:
|
||||
if _, err := io.ReadFull(r, e[:]); err != nil {
|
||||
|
Reference in New Issue
Block a user