watchtower/wtwire/create_session_reply: return last applied

This commit is contained in:
Conner Fromknecht committed 2019-04-23 20:05:47 -07:00
1 parent 9aa775e64e
commit 9b1bc9fd79
2 files changed
+20 -10

No files matched your search

@@ -43,6 +43,12 @@ type CreateSessionReply struct {
// Code will be non-zero if the watchtower rejected the session init.
Code CreateSessionCode
// LastApplied is the tower's last accepted sequence number for the
// session. This is useful when the session already exists but the
// client doesn't realize it's already used the session, such as after a
// restoration.
LastApplied uint16
// Data is a byte slice returned the caller of the message, and is to be
// interpreted according to the error Code. When the response is
// CreateSessionCodeOK, data encodes the reward address to be included in
@@ -63,6 +69,7 @@ var _ Message = (*CreateSessionReply)(nil)
func (m *CreateSessionReply) Decode(r io.Reader, pver uint32) error {
return ReadElements(r,
&m.Code,
&m.LastApplied,
&m.Data,
)
}
@@ -74,6 +81,7 @@ func (m *CreateSessionReply) Decode(r io.Reader, pver uint32) error {
func (m *CreateSessionReply) Encode(w io.Writer, pver uint32) error {
return WriteElements(w,
m.Code,
m.LastApplied,
m.Data,
)
}