lnwire: add extra opaque data to FailIncorrectDetails
This commit is contained in:
1 file changed
+17
-4
+17
-4
@@ -345,6 +345,9 @@ type FailIncorrectDetails struct {
|
|||||||
|
|
||||||
// height is the block height when the htlc was received.
|
// height is the block height when the htlc was received.
|
||||||
height uint32
|
height uint32
|
||||||
|
|
||||||
|
// extraOpaqueData contains additional failure message tlv data.
|
||||||
|
extraOpaqueData ExtraOpaqueData
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewFailIncorrectDetails makes a new instance of the FailIncorrectDetails
|
// NewFailIncorrectDetails makes a new instance of the FailIncorrectDetails
|
||||||
@@ -353,8 +356,9 @@ func NewFailIncorrectDetails(amt MilliSatoshi,
|
|||||||
height uint32) *FailIncorrectDetails {
|
height uint32) *FailIncorrectDetails {
|
||||||
|
|
||||||
return &FailIncorrectDetails{
|
return &FailIncorrectDetails{
|
||||||
amount: amt,
|
amount: amt,
|
||||||
height: height,
|
height: height,
|
||||||
|
extraOpaqueData: []byte{},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -368,6 +372,11 @@ func (f *FailIncorrectDetails) Height() uint32 {
|
|||||||
return f.height
|
return f.height
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ExtraOpaqueData returns additional failure message tlv data.
|
||||||
|
func (f *FailIncorrectDetails) ExtraOpaqueData() ExtraOpaqueData {
|
||||||
|
return f.extraOpaqueData
|
||||||
|
}
|
||||||
|
|
||||||
// Code returns the failure unique code.
|
// Code returns the failure unique code.
|
||||||
//
|
//
|
||||||
// NOTE: Part of the FailureMessage interface.
|
// NOTE: Part of the FailureMessage interface.
|
||||||
@@ -413,7 +422,7 @@ func (f *FailIncorrectDetails) Decode(r io.Reader, pver uint32) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return f.extraOpaqueData.Decode(r)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encode writes the failure in bytes stream.
|
// Encode writes the failure in bytes stream.
|
||||||
@@ -424,7 +433,11 @@ func (f *FailIncorrectDetails) Encode(w *bytes.Buffer, pver uint32) error {
|
|||||||
return err
|
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
|
// FailFinalExpiryTooSoon is returned if the cltv_expiry is too low, the final
|
||||||
|
|||||||
Reference in new issue
Block a user