mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 09:53:54 +01:00
lnwire: add extra opaque data to FailIncorrectDetails
This commit is contained in:
parent
5f4465b14f
commit
5ff5838d74
@ -345,6 +345,9 @@ type FailIncorrectDetails struct {
|
||||
|
||||
// height is the block height when the htlc was received.
|
||||
height uint32
|
||||
|
||||
// extraOpaqueData contains additional failure message tlv data.
|
||||
extraOpaqueData ExtraOpaqueData
|
||||
}
|
||||
|
||||
// NewFailIncorrectDetails makes a new instance of the FailIncorrectDetails
|
||||
@ -353,8 +356,9 @@ func NewFailIncorrectDetails(amt MilliSatoshi,
|
||||
height uint32) *FailIncorrectDetails {
|
||||
|
||||
return &FailIncorrectDetails{
|
||||
amount: amt,
|
||||
height: height,
|
||||
amount: amt,
|
||||
height: height,
|
||||
extraOpaqueData: []byte{},
|
||||
}
|
||||
}
|
||||
|
||||
@ -368,6 +372,11 @@ func (f *FailIncorrectDetails) Height() uint32 {
|
||||
return f.height
|
||||
}
|
||||
|
||||
// ExtraOpaqueData returns additional failure message tlv data.
|
||||
func (f *FailIncorrectDetails) ExtraOpaqueData() ExtraOpaqueData {
|
||||
return f.extraOpaqueData
|
||||
}
|
||||
|
||||
// Code returns the failure unique code.
|
||||
//
|
||||
// NOTE: Part of the FailureMessage interface.
|
||||
@ -413,7 +422,7 @@ func (f *FailIncorrectDetails) Decode(r io.Reader, pver uint32) error {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return f.extraOpaqueData.Decode(r)
|
||||
}
|
||||
|
||||
// Encode writes the failure in bytes stream.
|
||||
@ -424,7 +433,11 @@ func (f *FailIncorrectDetails) Encode(w *bytes.Buffer, pver uint32) error {
|
||||
return err
|
||||
}
|
||||
|
||||
return WriteUint32(w, f.height)
|
||||
if err := WriteUint32(w, f.height); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return f.extraOpaqueData.Encode(w)
|
||||
}
|
||||
|
||||
// FailFinalExpiryTooSoon is returned if the cltv_expiry is too low, the final
|
||||
|
Loading…
Reference in New Issue
Block a user