-
Notifications
You must be signed in to change notification settings - Fork 44
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
feat: Add ability to display peer id #719
Conversation
One of the test is failing for a known reason. Trying to come up with a solution but in the mean time I welcome your feedback on the rest of the code :) |
1e8951c
to
100d6d9
Compare
Codecov Report
@@ Coverage Diff @@
## develop #719 +/- ##
===========================================
+ Coverage 57.66% 58.02% +0.36%
===========================================
Files 143 144 +1
Lines 16456 16593 +137
===========================================
+ Hits 9489 9628 +139
+ Misses 6083 6052 -31
- Partials 884 913 +29
|
3942f22
to
2b49372
Compare
http.Server | ||
} | ||
|
||
type serverOptions struct { | ||
allowedOrigins []string | ||
peerID 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.
question (non-blocking): I wonder what is best: to pass the peerID as param to http API and for it to be part of context of each request, or for the http API to not hold the info and instead obtain the info from node
every time.
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.
Adding the info to the context is very lightweight. Not sure how it would obtain the info from node
.
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.
Adding a .PeerID()
func to the node interface, which replies either with an empty string or its PeerID
?
If the public key of a node changes, its PeerID would have to change. When that happens, with the construction of this PR, we would also have to restart the HTTP API. I'm not convinced that supporting live changing the public key and PeerID of a node is a good idea, but I do want to acknowledge the dependency that is made 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.
This PR already adds a PeerID
method to the node. But the HTTP API isn't aware of the node at the moment. In the future it probably should be though. So right now the only way this can work is if we pass along the PeerID to the HTTP API when we start the instance.
57dd095
to
cab57e8
Compare
@@ -91,34 +91,44 @@ func (l *logger) FatalE(ctx context.Context, message string, err error, keyvals | |||
|
|||
func (l *logger) FeedbackInfo(ctx context.Context, message string, keyvals ...KV) { | |||
l.Info(ctx, message, keyvals...) | |||
l.syncLock.RLock() |
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.
question: why?
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.
Because with the new test there was a race condition error caused by trying to read consoleLogger
while it was being set.
suggestion: Because the PR now has more changes than what stated in its title, the title should be update to represent that |
All changes are related to what is represented in the PR title. Not sure it really has to change. |
e7d60e2
to
667f441
Compare
f0b64c7
to
24696a3
Compare
24696a3
to
f48bd08
Compare
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
Just a few typos to fix
Very glad that we have someone on the team that has a radar for that kind of thing. 😄 |
Description This PR adds the ability to display the peer id of a given node both through the HTTP API and CLI.
Relevant issue(s)
Resolves #663
Description
This PR adds the ability to display the peer id of a given node both through the HTTP API and CLI.
Tasks
How has this been tested?
unit tests and manual tests
Specify the platform(s) on which this was tested: