Skip to content
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

use curl to fetch from lokid rpc the identity key #931

Merged

Conversation

@majestrate
Copy link
Collaborator

majestrate commented Nov 26, 2019

No description provided.

majestrate added 3 commits Nov 26, 2019
@majestrate majestrate requested a review from jagerman Nov 26, 2019
CURLcode res;
std::stringstream ss;
ss << "http://" << lokidRPCAddr << "/json_rpc";
const auto url = ss.str();

This comment has been minimized.

Copy link
@jagerman

jagerman Nov 26, 2019

Collaborator

Simpler here just to use string concatenation: const auto url = "http://" + lokidRPCAddr + "/json_rpc";

This comment has been minimized.

Copy link
@jagerman

jagerman Nov 26, 2019

Collaborator

(Assuming lokidRPCAddr is already a std::string; otherwise wrap one of these in a std::string{...} to make it work)

majestrate added 2 commits Nov 26, 2019
if(not itr->is_object())
continue;
const auto k =
(*itr)["service_node_ed25519_privkey"].get< std::string >();

This comment has been minimized.

Copy link
@jagerman

jagerman Nov 26, 2019

Collaborator

You should .find() this and error out if it's not present in case someone runs it against a 5.x lokid.

{
LogError("failed to get identity Keys");
}
} while(res != CURLE_OK);

This comment has been minimized.

Copy link
@notlesh

notlesh Nov 26, 2019

Collaborator

Will this result in an infinite loop when we get an error?

@majestrate majestrate merged commit 8288bf3 into loki-project:dev Dec 3, 2019
1 check failed
1 check failed
continuous-integration/travis-ci/pr The Travis CI build failed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.