wire: add PendingID in ErrorGeneric
This commit is contained in:
parent
14c6770b76
commit
b0525cf478
@ -25,6 +25,13 @@ type ErrorGeneric struct {
|
|||||||
// nature of the exact error. The maximum allowed length of this
|
// nature of the exact error. The maximum allowed length of this
|
||||||
// message is 8192 bytes.
|
// message is 8192 bytes.
|
||||||
Problem string
|
Problem string
|
||||||
|
|
||||||
|
// PendingChannelID allows peers communicate errors in the context of a
|
||||||
|
// particular pending channel. With this field, once a peer reads an
|
||||||
|
// ErrorGeneric message with the PendingChannelID field set, then they
|
||||||
|
// can forward the error to the fundingManager who can handle it
|
||||||
|
// properly.
|
||||||
|
PendingChannelID uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewErrorGeneric creates a new ErrorGeneric message.
|
// NewErrorGeneric creates a new ErrorGeneric message.
|
||||||
@ -47,6 +54,7 @@ func (c *ErrorGeneric) Decode(r io.Reader, pver uint32) error {
|
|||||||
&c.ChannelPoint,
|
&c.ChannelPoint,
|
||||||
&c.ErrorID,
|
&c.ErrorID,
|
||||||
&c.Problem,
|
&c.Problem,
|
||||||
|
&c.PendingChannelID,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -64,6 +72,7 @@ func (c *ErrorGeneric) Encode(w io.Writer, pver uint32) error {
|
|||||||
c.ChannelPoint,
|
c.ChannelPoint,
|
||||||
c.ErrorID,
|
c.ErrorID,
|
||||||
c.Problem,
|
c.Problem,
|
||||||
|
c.PendingChannelID,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -110,5 +119,6 @@ func (c *ErrorGeneric) String() string {
|
|||||||
fmt.Sprintf("ChannelPoint:\t%d\n", c.ChannelPoint) +
|
fmt.Sprintf("ChannelPoint:\t%d\n", c.ChannelPoint) +
|
||||||
fmt.Sprintf("ErrorID:\t%d\n", c.ErrorID) +
|
fmt.Sprintf("ErrorID:\t%d\n", c.ErrorID) +
|
||||||
fmt.Sprintf("Problem:\t%s\n", c.Problem) +
|
fmt.Sprintf("Problem:\t%s\n", c.Problem) +
|
||||||
|
fmt.Sprintf("PendingChannelID:\t%s\n", c.PendingChannelID) +
|
||||||
fmt.Sprintf("--- End ErrorGeneric ---\n")
|
fmt.Sprintf("--- End ErrorGeneric ---\n")
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ func TestErrorGenericEncodeDecode(t *testing.T) {
|
|||||||
ChannelPoint: outpoint1,
|
ChannelPoint: outpoint1,
|
||||||
ErrorID: 99,
|
ErrorID: 99,
|
||||||
Problem: "Hello world!",
|
Problem: "Hello world!",
|
||||||
|
PendingChannelID: 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Next encode the EG message into an empty bytes buffer.
|
// Next encode the EG message into an empty bytes buffer.
|
||||||
|
Loading…
Reference in New Issue
Block a user