-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
routing: moved routing package inside lnd #70
routing: moved routing package inside lnd #70
Conversation
|
||
var NilID = ID{ID: [33]byte{}} | ||
|
||
func NewIDDebug(s interface{}) ID { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It isn't clear to me why this function is needed. The function below NewID
seems to be sufficient, as within our graph vertexes are always public keys serialized in compressed format.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NewIDDebug deleted.
return err | ||
} | ||
case graph.ID: | ||
s := e.String() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is graph.ID
converted to a string before encoding the element? It would
I don't think that graph.ID
should be converted to a string before encoding the element. Instead the relevant fields should be publicly exposed, then serialized individually one level up (within the Encode
/Decode
) functions. The encoding should be as efficient as possible, so a raw binary encoding of the struct should be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted. lnwire decoupled from graph.
return err | ||
} | ||
} | ||
case rt.OperationType: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar comments apply to the handling of the case statements from here to the comment above.
Most of the logic that's currently within the case statement of each of the routing related structs should be within the Encode/Decode
methods of their respective lnwire
structs.
return err | ||
} | ||
for i:=0; i<len(e); i++ { | ||
writeElement(w, e[i]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error is being ignored here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted. lnwire decoupled from graph.
return err | ||
} | ||
for i:=0; i<len(e); i++ { | ||
writeElement(w, e[i]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error is being ignored here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted. lnwire decoupled from graph
} | ||
} | ||
|
||
func init() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This init function is no longer needed as we now have (after my review comments are addressed) manual serialization of the relevant objects in the lnwire
package.
} | ||
|
||
// Marshall into object. Difference buffers are NOT marshalled. | ||
func (rt *RoutingTable) Marshall(w io.Writer) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These gob functions are no longer needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted.
} | ||
|
||
// Returns copy of channel info for channel in routing table | ||
func (rt *RoutingTable) GetChannelInfo(id1, id2 graph.ID, edgeId graph.EdgeID) (*graph.ChannelInfo, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this function is needed since the graph itself is currently publicly exported.
// Distributed under the MIT software license, see the accompanying | ||
// file LICENSE or http://www.opensource.org/licenses/mit-license.php | ||
|
||
package visualizer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All publicly exported variables in this package are missing godoc-style comments. Also, I think this package should be converted to an internal golang package.
tgt = viz.ApplyToNode(tgt) | ||
if viz.Config.EnableShortcut { | ||
// TODO(evg): processing errors | ||
src, _ = viz.pt.Shortcut(src) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The errors here shouldn't be ignored. Also I think many of the functions should not be publicly exported. Instead, only the necessary public entrance points need to be exposed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM ✨
Thanks for all the hardwork on this PR! This'll serve as a fine basis for routing within the daemon.
I'll get this merged as soon as the merge conflicts are resolved on this branch.
Use [33]byte for graph vertex representation. Delete unneeded stuff: 1. DeepEqual for graph comparison 2. EdgePath 3. 2-thread BFS 4. Table transfer messages and neighborhood radius 5. Beacons Refactor: 1. Change ID to Vertex 2. Test use table driven approach 3. Add comments 4. Make graph internal representation private 5. Use wire.OutPoint as EdgeId 6. Decouple routing messages from routing implementation 7. Delete Async methods 8. Delete unneeded channels and priority buffer from manager 9. Delete unneeded interfaces in internal graph realisation 10. Renamed ID to Vertex
I've rebased and squashed commits. Is it bug in the tests or in the code? |
There's some occasional negative interaction between the integration tests that I haven't yet quite pinned down which causes the occasional flakiness you're seeing. I have a few more items on my personal TODO list, but will hopefully eliminate the flakiness in the next few days. |
….beta Upgrade to LND 0.14.2 release
Moved routing tools inside lnd. Changed internal type of graph.ID
from string to [33]byte.