mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-22 22:25:24 +01:00
channeldb: also ignore the EOF error when trying to read ExtraOpaqueBytes
In this commit, we account for the additional case wherein the announcement hasn't yet been written with the extra zero byte to indicate that there aren't any remaining bytes to be read. Before this commit, we accounted for the case where the announcement was written with the extra byte, but now we ensure that legacy nodes that upgrade will be able to boot properly.
This commit is contained in:
parent
48072f8e82
commit
785efcfaa2
1 changed files with 12 additions and 3 deletions
|
@ -2860,7 +2860,10 @@ func deserializeLightningNode(r io.Reader) (LightningNode, error) {
|
|||
node.ExtraOpaqueData, err = wire.ReadVarBytes(
|
||||
r, 0, MaxAllowedExtraOpaqueBytes, "blob",
|
||||
)
|
||||
if err != nil && err != io.ErrUnexpectedEOF {
|
||||
switch {
|
||||
case err == io.ErrUnexpectedEOF:
|
||||
case err == io.EOF:
|
||||
case err != nil:
|
||||
return LightningNode{}, err
|
||||
}
|
||||
|
||||
|
@ -3012,7 +3015,10 @@ func deserializeChanEdgeInfo(r io.Reader) (ChannelEdgeInfo, error) {
|
|||
edgeInfo.ExtraOpaqueData, err = wire.ReadVarBytes(
|
||||
r, 0, MaxAllowedExtraOpaqueBytes, "blob",
|
||||
)
|
||||
if err != nil && err != io.ErrUnexpectedEOF {
|
||||
switch {
|
||||
case err == io.ErrUnexpectedEOF:
|
||||
case err == io.EOF:
|
||||
case err != nil:
|
||||
return ChannelEdgeInfo{}, err
|
||||
}
|
||||
|
||||
|
@ -3260,7 +3266,10 @@ func deserializeChanEdgePolicy(r io.Reader,
|
|||
edge.ExtraOpaqueData, err = wire.ReadVarBytes(
|
||||
r, 0, MaxAllowedExtraOpaqueBytes, "blob",
|
||||
)
|
||||
if err != nil && err != io.ErrUnexpectedEOF {
|
||||
switch {
|
||||
case err == io.ErrUnexpectedEOF:
|
||||
case err == io.EOF:
|
||||
case err != nil:
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue