-
Notifications
You must be signed in to change notification settings - Fork 2.3k
channeldb: write the CommitSig in CommitDiff in LN wire format #4099
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| package channeldb | ||
|
|
||
| import ( | ||
| "bytes" | ||
| "encoding/binary" | ||
| "fmt" | ||
| "io" | ||
|
|
@@ -178,7 +179,17 @@ func WriteElement(w io.Writer, element interface{}) error { | |
| } | ||
|
|
||
| case lnwire.Message: | ||
| if _, err := lnwire.WriteMessage(w, e, 0); err != nil { | ||
| var msgBuf bytes.Buffer | ||
| if _, err := lnwire.WriteMessage(&msgBuf, e, 0); err != nil { | ||
| return err | ||
| } | ||
|
|
||
| msgLen := uint16(len(msgBuf.Bytes())) | ||
| if err := WriteElements(w, msgLen); err != nil { | ||
| return err | ||
| } | ||
|
|
||
| if _, err := w.Write(msgBuf.Bytes()); err != nil { | ||
|
Roasbeef marked this conversation as resolved.
Outdated
|
||
| return err | ||
| } | ||
|
|
||
|
|
@@ -394,7 +405,13 @@ func ReadElement(r io.Reader, element interface{}) error { | |
| *e = bytes | ||
|
|
||
| case *lnwire.Message: | ||
| msg, err := lnwire.ReadMessage(r, 0) | ||
| var msgLen uint16 | ||
| if err := ReadElement(r, &msgLen); err != nil { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we know that These are all the messages I found passing through this codec in
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think one other message is the I'm gonna rebase that on top of this, and run the tests there, which in the past have let me catch other issues in this base migration.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh I think those are the
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| return err | ||
| } | ||
|
|
||
| msgReader := io.LimitReader(r, int64(msgLen)) | ||
| msg, err := lnwire.ReadMessage(msgReader, 0) | ||
| if err != nil { | ||
| return err | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.