{"action":"created","comment":{"url":"https://api.github.com/repos/stellar/stellar-core/pulls/comments/189756796","pull_request_review_id":121986079,"id":189756796,"diff_hunk":"@@ -0,0 +1,237 @@\n+// Copyright 2018 Stellar Development Foundation and contributors. Licensed\n+// under the Apache License, Version 2.0. See the COPYING file at the root\n+// of this distribution or at http://www.apache.org/licenses/LICENSE-2.0\n+\n+#include \"herder/FetchingEnvelopes.h\"\n+#include \"crypto/Hex.h\"\n+#include \"crypto/SHA.h\"\n+#include \"herder/Herder.h\"\n+#include \"herder/HerderUtils.h\"\n+#include \"item/ItemFetcher.h\"\n+#include \"main/Application.h\"\n+#include \"overlay/OverlayManager.h\"\n+#include \"overlay/QSetCache.h\"\n+#include \"overlay/TxSetCache.h\"\n+#include \"scp/QuorumSetUtils.h\"\n+#include \"util/Logging.h\"\n+\n+#include <xdrpp/marshal.h>\n+\n+namespace stellar\n+{\n+\n+using xdr::operator<;\n+\n+FetchingEnvelopes::FetchingEnvelopes(Application& app)\n+    : mApp(app), mNodesInQuorum(mApp)\n+{\n+}\n+\n+FetchingEnvelopes::~FetchingEnvelopes()\n+{\n+}\n+\n+bool\n+FetchingEnvelopes::handleEnvelope(Peer::pointer peer,\n+                                  SCPEnvelope const& envelope)\n+{\n+    if (isDiscarded(envelope))\n+    {\n+        return false;\n+    }\n+\n+    auto items = itemsToFetch(envelope);\n+    if (items.empty())\n+    {\n+        return true;\n+    }\n+    else\n+    {\n+        startFetching(peer, envelope, items);\n+        return false;\n+    }\n+}\n+\n+std::set<SCPEnvelope>\n+FetchingEnvelopes::handleQuorumSet(const SCPQuorumSet& q, bool force)\n+{\n+    auto itemKey = ItemKey{ItemType::QUORUM_SET, sha256(xdr::xdr_to_opaque(q))};","path":"src/herder/FetchingEnvelopes.cpp","position":58,"original_position":58,"commit_id":"2d3c1ddf27b6061cf2dbde95ea8eb1c538398647","original_commit_id":"2d3c1ddf27b6061cf2dbde95ea8eb1c538398647","user":{"login":"MonsieurNicolas","id":4213763,"avatar_url":"https://avatars3.githubusercontent.com/u/4213763?v=4","gravatar_id":"","url":"https://api.github.com/users/MonsieurNicolas","html_url":"https://github.com/MonsieurNicolas","followers_url":"https://api.github.com/users/MonsieurNicolas/followers","following_url":"https://api.github.com/users/MonsieurNicolas/following{/other_user}","gists_url":"https://api.github.com/users/MonsieurNicolas/gists{/gist_id}","starred_url":"https://api.github.com/users/MonsieurNicolas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MonsieurNicolas/subscriptions","organizations_url":"https://api.github.com/users/MonsieurNicolas/orgs","repos_url":"https://api.github.com/users/MonsieurNicolas/repos","events_url":"https://api.github.com/users/MonsieurNicolas/events{/privacy}","received_events_url":"https://api.github.com/users/MonsieurNicolas/received_events","type":"User","site_admin":false},"body":"Per my other comment, the fact that `hash(x)` is used as a key is an implementation detail of overlay; there is no need to have this done in herder. NB: it doesn't mean that you can't have methods that lookup by hash exposed by overlay","created_at":"2018-05-22T01:37:22Z","updated_at":"2018-05-22T01:56:53Z","html_url":"https://github.com/stellar/stellar-core/pull/1670#discussion_r189756796","pull_request_url":"https://api.github.com/repos/stellar/stellar-core/pulls/1670","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/stellar/stellar-core/pulls/comments/189756796"},"html":{"href":"https://github.com/stellar/stellar-core/pull/1670#discussion_r189756796"},"pull_request":{"href":"https://api.github.com/repos/stellar/stellar-core/pulls/1670"}}},"pull_request":{"url":"https://api.github.com/repos/stellar/stellar-core/pulls/1670","id":183244703,"html_url":"https://github.com/stellar/stellar-core/pull/1670","diff_url":"https://github.com/stellar/stellar-core/pull/1670.diff","patch_url":"https://github.com/stellar/stellar-core/pull/1670.patch","issue_url":"https://api.github.com/repos/stellar/stellar-core/issues/1670","number":1670,"state":"open","locked":false,"title":"Improve item fetcher","user":{"login":"vogel","id":101391,"avatar_url":"https://avatars2.githubusercontent.com/u/101391?v=4","gravatar_id":"","url":"https://api.github.com/users/vogel","html_url":"https://github.com/vogel","followers_url":"https://api.github.com/users/vogel/followers","following_url":"https://api.github.com/users/vogel/following{/other_user}","gists_url":"https://api.github.com/users/vogel/gists{/gist_id}","starred_url":"https://api.github.com/users/vogel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vogel/subscriptions","organizations_url":"https://api.github.com/users/vogel/orgs","repos_url":"https://api.github.com/users/vogel/repos","events_url":"https://api.github.com/users/vogel/events{/privacy}","received_events_url":"https://api.github.com/users/vogel/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-04-21T22:13:52Z","updated_at":"2018-05-22T01:56:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dede5783cec4c480959ba2e68cb66381fc619b3f","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/stellar/stellar-core/pulls/1670/commits","review_comments_url":"https://api.github.com/repos/stellar/stellar-core/pulls/1670/comments","review_comment_url":"https://api.github.com/repos/stellar/stellar-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/stellar/stellar-core/issues/1670/comments","statuses_url":"https://api.github.com/repos/stellar/stellar-core/statuses/2d3c1ddf27b6061cf2dbde95ea8eb1c538398647","head":{"label":"vogel:improve-item-fetcher","ref":"improve-item-fetcher","sha":"2d3c1ddf27b6061cf2dbde95ea8eb1c538398647","user":{"login":"vogel","id":101391,"avatar_url":"https://avatars2.githubusercontent.com/u/101391?v=4","gravatar_id":"","url":"https://api.github.com/users/vogel","html_url":"https://github.com/vogel","followers_url":"https://api.github.com/users/vogel/followers","following_url":"https://api.github.com/users/vogel/following{/other_user}","gists_url":"https://api.github.com/users/vogel/gists{/gist_id}","starred_url":"https://api.github.com/users/vogel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vogel/subscriptions","organizations_url":"https://api.github.com/users/vogel/orgs","repos_url":"https://api.github.com/users/vogel/repos","events_url":"https://api.github.com/users/vogel/events{/privacy}","received_events_url":"https://api.github.com/users/vogel/received_events","type":"User","site_admin":false},"repo":{"id":59241865,"name":"stellar-core","full_name":"vogel/stellar-core","owner":{"login":"vogel","id":101391,"avatar_url":"https://avatars2.githubusercontent.com/u/101391?v=4","gravatar_id":"","url":"https://api.github.com/users/vogel","html_url":"https://github.com/vogel","followers_url":"https://api.github.com/users/vogel/followers","following_url":"https://api.github.com/users/vogel/following{/other_user}","gists_url":"https://api.github.com/users/vogel/gists{/gist_id}","starred_url":"https://api.github.com/users/vogel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vogel/subscriptions","organizations_url":"https://api.github.com/users/vogel/orgs","repos_url":"https://api.github.com/users/vogel/repos","events_url":"https://api.github.com/users/vogel/events{/privacy}","received_events_url":"https://api.github.com/users/vogel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vogel/stellar-core","description":"stellar-core is the backbone of the Stellar network. It maintains a local copy of the ledger, communicating and staying in sync with other instances of stellar-core on the network. Optionally, stellar-core can store historical records of the ledger and participate in consensus.","fork":true,"url":"https://api.github.com/repos/vogel/stellar-core","forks_url":"https://api.github.com/repos/vogel/stellar-core/forks","keys_url":"https://api.github.com/repos/vogel/stellar-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vogel/stellar-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vogel/stellar-core/teams","hooks_url":"https://api.github.com/repos/vogel/stellar-core/hooks","issue_events_url":"https://api.github.com/repos/vogel/stellar-core/issues/events{/number}","events_url":"https://api.github.com/repos/vogel/stellar-core/events","assignees_url":"https://api.github.com/repos/vogel/stellar-core/assignees{/user}","branches_url":"https://api.github.com/repos/vogel/stellar-core/branches{/branch}","tags_url":"https://api.github.com/repos/vogel/stellar-core/tags","blobs_url":"https://api.github.com/repos/vogel/stellar-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vogel/stellar-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vogel/stellar-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/vogel/stellar-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vogel/stellar-core/statuses/{sha}","languages_url":"https://api.github.com/repos/vogel/stellar-core/languages","stargazers_url":"https://api.github.com/repos/vogel/stellar-core/stargazers","contributors_url":"https://api.github.com/repos/vogel/stellar-core/contributors","subscribers_url":"https://api.github.com/repos/vogel/stellar-core/subscribers","subscription_url":"https://api.github.com/repos/vogel/stellar-core/subscription","commits_url":"https://api.github.com/repos/vogel/stellar-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/vogel/stellar-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/vogel/stellar-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/vogel/stellar-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/vogel/stellar-core/contents/{+path}","compare_url":"https://api.github.com/repos/vogel/stellar-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vogel/stellar-core/merges","archive_url":"https://api.github.com/repos/vogel/stellar-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vogel/stellar-core/downloads","issues_url":"https://api.github.com/repos/vogel/stellar-core/issues{/number}","pulls_url":"https://api.github.com/repos/vogel/stellar-core/pulls{/number}","milestones_url":"https://api.github.com/repos/vogel/stellar-core/milestones{/number}","notifications_url":"https://api.github.com/repos/vogel/stellar-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vogel/stellar-core/labels{/name}","releases_url":"https://api.github.com/repos/vogel/stellar-core/releases{/id}","deployments_url":"https://api.github.com/repos/vogel/stellar-core/deployments","created_at":"2016-05-19T20:51:49Z","updated_at":"2018-05-21T09:35:29Z","pushed_at":"2018-05-21T09:35:27Z","git_url":"git://github.com/vogel/stellar-core.git","ssh_url":"git@github.com:vogel/stellar-core.git","clone_url":"https://github.com/vogel/stellar-core.git","svn_url":"https://github.com/vogel/stellar-core","homepage":"","size":15264,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"stellar:master","ref":"master","sha":"7422c980c8c98cd50bfb0e1c1c0e606c10bdd240","user":{"login":"stellar","id":7386716,"avatar_url":"https://avatars3.githubusercontent.com/u/7386716?v=4","gravatar_id":"","url":"https://api.github.com/users/stellar","html_url":"https://github.com/stellar","followers_url":"https://api.github.com/users/stellar/followers","following_url":"https://api.github.com/users/stellar/following{/other_user}","gists_url":"https://api.github.com/users/stellar/gists{/gist_id}","starred_url":"https://api.github.com/users/stellar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stellar/subscriptions","organizations_url":"https://api.github.com/users/stellar/orgs","repos_url":"https://api.github.com/users/stellar/repos","events_url":"https://api.github.com/users/stellar/events{/privacy}","received_events_url":"https://api.github.com/users/stellar/received_events","type":"Organization","site_admin":false},"repo":{"id":27085821,"name":"stellar-core","full_name":"stellar/stellar-core","owner":{"login":"stellar","id":7386716,"avatar_url":"https://avatars3.githubusercontent.com/u/7386716?v=4","gravatar_id":"","url":"https://api.github.com/users/stellar","html_url":"https://github.com/stellar","followers_url":"https://api.github.com/users/stellar/followers","following_url":"https://api.github.com/users/stellar/following{/other_user}","gists_url":"https://api.github.com/users/stellar/gists{/gist_id}","starred_url":"https://api.github.com/users/stellar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stellar/subscriptions","organizations_url":"https://api.github.com/users/stellar/orgs","repos_url":"https://api.github.com/users/stellar/repos","events_url":"https://api.github.com/users/stellar/events{/privacy}","received_events_url":"https://api.github.com/users/stellar/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/stellar/stellar-core","description":"stellar-core is the backbone of the Stellar network. It maintains a local copy of the ledger, communicating and staying in sync with other instances of stellar-core on the network. Optionally, stellar-core can store historical records of the ledger and participate in consensus.","fork":false,"url":"https://api.github.com/repos/stellar/stellar-core","forks_url":"https://api.github.com/repos/stellar/stellar-core/forks","keys_url":"https://api.github.com/repos/stellar/stellar-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stellar/stellar-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stellar/stellar-core/teams","hooks_url":"https://api.github.com/repos/stellar/stellar-core/hooks","issue_events_url":"https://api.github.com/repos/stellar/stellar-core/issues/events{/number}","events_url":"https://api.github.com/repos/stellar/stellar-core/events","assignees_url":"https://api.github.com/repos/stellar/stellar-core/assignees{/user}","branches_url":"https://api.github.com/repos/stellar/stellar-core/branches{/branch}","tags_url":"https://api.github.com/repos/stellar/stellar-core/tags","blobs_url":"https://api.github.com/repos/stellar/stellar-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stellar/stellar-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stellar/stellar-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/stellar/stellar-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stellar/stellar-core/statuses/{sha}","languages_url":"https://api.github.com/repos/stellar/stellar-core/languages","stargazers_url":"https://api.github.com/repos/stellar/stellar-core/stargazers","contributors_url":"https://api.github.com/repos/stellar/stellar-core/contributors","subscribers_url":"https://api.github.com/repos/stellar/stellar-core/subscribers","subscription_url":"https://api.github.com/repos/stellar/stellar-core/subscription","commits_url":"https://api.github.com/repos/stellar/stellar-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/stellar/stellar-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/stellar/stellar-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/stellar/stellar-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/stellar/stellar-core/contents/{+path}","compare_url":"https://api.github.com/repos/stellar/stellar-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stellar/stellar-core/merges","archive_url":"https://api.github.com/repos/stellar/stellar-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stellar/stellar-core/downloads","issues_url":"https://api.github.com/repos/stellar/stellar-core/issues{/number}","pulls_url":"https://api.github.com/repos/stellar/stellar-core/pulls{/number}","milestones_url":"https://api.github.com/repos/stellar/stellar-core/milestones{/number}","notifications_url":"https://api.github.com/repos/stellar/stellar-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stellar/stellar-core/labels{/name}","releases_url":"https://api.github.com/repos/stellar/stellar-core/releases{/id}","deployments_url":"https://api.github.com/repos/stellar/stellar-core/deployments","created_at":"2014-11-24T17:11:12Z","updated_at":"2018-05-22T00:35:14Z","pushed_at":"2018-05-22T00:35:11Z","git_url":"git://github.com/stellar/stellar-core.git","ssh_url":"git@github.com:stellar/stellar-core.git","clone_url":"https://github.com/stellar/stellar-core.git","svn_url":"https://github.com/stellar/stellar-core","homepage":"","size":14955,"stargazers_count":1557,"watchers_count":1557,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":422,"mirror_url":null,"archived":false,"open_issues_count":124,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":422,"open_issues":124,"watchers":1557,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/stellar/stellar-core/pulls/1670"},"html":{"href":"https://github.com/stellar/stellar-core/pull/1670"},"issue":{"href":"https://api.github.com/repos/stellar/stellar-core/issues/1670"},"comments":{"href":"https://api.github.com/repos/stellar/stellar-core/issues/1670/comments"},"review_comments":{"href":"https://api.github.com/repos/stellar/stellar-core/pulls/1670/comments"},"review_comment":{"href":"https://api.github.com/repos/stellar/stellar-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/stellar/stellar-core/pulls/1670/commits"},"statuses":{"href":"https://api.github.com/repos/stellar/stellar-core/statuses/2d3c1ddf27b6061cf2dbde95ea8eb1c538398647"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"MonsieurNicolas"}}