{"action":"created","comment":{"url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/35008888","id":35008888,"diff_hunk":"@@ -242,9 +264,20 @@ bool CRollingBloomFilter::contains(const std::vector<unsigned char>& vKey) const\n     return b1.contains(vKey);\n }\n \n-void CRollingBloomFilter::clear()\n+bool CRollingBloomFilter::contains(const uint256& hash) const\n {\n-    b1.clear();\n-    b2.clear();\n+    if (nInsertions < nBloomSize / 2) {\n+        return b2.contains(hash);\n+    }\n+    return b1.contains(hash);\n+}\n+\n+void CRollingBloomFilter::reset(unsigned int nNewTweak)\n+{\n+    if (!nNewTweak)\n+        nNewTweak = GetRand(std::numeric_limits<unsigned int>::max());","path":"src/bloom.cpp","position":70,"original_position":70,"commit_id":"65c4c69c8504724eabb6385b3a6e917c5b85290a","original_commit_id":"767e5366a1147c5e44bb7fcc54aa0609141b8e37","user":{"login":"petertodd","id":7042,"avatar_url":"https://avatars.githubusercontent.com/u/7042?v=3","gravatar_id":"","url":"https://api.github.com/users/petertodd","html_url":"https://github.com/petertodd","followers_url":"https://api.github.com/users/petertodd/followers","following_url":"https://api.github.com/users/petertodd/following{/other_user}","gists_url":"https://api.github.com/users/petertodd/gists{/gist_id}","starred_url":"https://api.github.com/users/petertodd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petertodd/subscriptions","organizations_url":"https://api.github.com/users/petertodd/orgs","repos_url":"https://api.github.com/users/petertodd/repos","events_url":"https://api.github.com/users/petertodd/events{/privacy}","received_events_url":"https://api.github.com/users/petertodd/received_events","type":"User","site_admin":false},"body":"Notice how rust is designed such that no code is executed prior to main()...\r\n\r\nRight, so you're worried that I may have introduced an occasional crashing bug or something? Maybe we need a GetRandButItsOkIfSometimesItDoesntWork() that doesn't crash if RAND_bytes() fails :/","created_at":"2015-07-20T15:42:44Z","updated_at":"2015-07-20T15:42:44Z","html_url":"https://github.com/bitcoin/bitcoin/pull/6452#discussion_r35008888","pull_request_url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/6452","_links":{"self":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/35008888"},"html":{"href":"https://github.com/bitcoin/bitcoin/pull/6452#discussion_r35008888"},"pull_request":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/6452"}}},"pull_request":{"url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/6452","id":40220453,"html_url":"https://github.com/bitcoin/bitcoin/pull/6452","diff_url":"https://github.com/bitcoin/bitcoin/pull/6452.diff","patch_url":"https://github.com/bitcoin/bitcoin/pull/6452.patch","issue_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/6452","number":6452,"state":"open","locked":false,"title":"Keep track of recently rejected transactions with a rolling bloom filter","user":{"login":"petertodd","id":7042,"avatar_url":"https://avatars.githubusercontent.com/u/7042?v=3","gravatar_id":"","url":"https://api.github.com/users/petertodd","html_url":"https://github.com/petertodd","followers_url":"https://api.github.com/users/petertodd/followers","following_url":"https://api.github.com/users/petertodd/following{/other_user}","gists_url":"https://api.github.com/users/petertodd/gists{/gist_id}","starred_url":"https://api.github.com/users/petertodd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petertodd/subscriptions","organizations_url":"https://api.github.com/users/petertodd/orgs","repos_url":"https://api.github.com/users/petertodd/repos","events_url":"https://api.github.com/users/petertodd/events{/privacy}","received_events_url":"https://api.github.com/users/petertodd/received_events","type":"User","site_admin":false},"body":"@marcos's #6450, but with a rolling bloom filter instead of a limitedmap. The number of rejected txids saved has been greatly improved, which should help in some attack scenarios. In addition the filter is now cleared every time the chaintip changes, rather than based on a timeout, to better match the cases where a previously rejected transaction would now be valid. (nLockTime, double-spends, etc.)","created_at":"2015-07-17T10:55:40Z","updated_at":"2015-07-20T15:42:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"18321c5f0d988de6e3c1a01c73e52342a96283c0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/6452/commits","review_comments_url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/6452/comments","review_comment_url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/6452/comments","statuses_url":"https://api.github.com/repos/bitcoin/bitcoin/statuses/65c4c69c8504724eabb6385b3a6e917c5b85290a","head":{"label":"petertodd:recent-rejects-rolling-bloom","ref":"recent-rejects-rolling-bloom","sha":"65c4c69c8504724eabb6385b3a6e917c5b85290a","user":{"login":"petertodd","id":7042,"avatar_url":"https://avatars.githubusercontent.com/u/7042?v=3","gravatar_id":"","url":"https://api.github.com/users/petertodd","html_url":"https://github.com/petertodd","followers_url":"https://api.github.com/users/petertodd/followers","following_url":"https://api.github.com/users/petertodd/following{/other_user}","gists_url":"https://api.github.com/users/petertodd/gists{/gist_id}","starred_url":"https://api.github.com/users/petertodd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petertodd/subscriptions","organizations_url":"https://api.github.com/users/petertodd/orgs","repos_url":"https://api.github.com/users/petertodd/repos","events_url":"https://api.github.com/users/petertodd/events{/privacy}","received_events_url":"https://api.github.com/users/petertodd/received_events","type":"User","site_admin":false},"repo":{"id":5992112,"name":"bitcoin","full_name":"petertodd/bitcoin","owner":{"login":"petertodd","id":7042,"avatar_url":"https://avatars.githubusercontent.com/u/7042?v=3","gravatar_id":"","url":"https://api.github.com/users/petertodd","html_url":"https://github.com/petertodd","followers_url":"https://api.github.com/users/petertodd/followers","following_url":"https://api.github.com/users/petertodd/following{/other_user}","gists_url":"https://api.github.com/users/petertodd/gists{/gist_id}","starred_url":"https://api.github.com/users/petertodd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petertodd/subscriptions","organizations_url":"https://api.github.com/users/petertodd/orgs","repos_url":"https://api.github.com/users/petertodd/repos","events_url":"https://api.github.com/users/petertodd/events{/privacy}","received_events_url":"https://api.github.com/users/petertodd/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/petertodd/bitcoin","description":"Bitcoin integration/staging tree","fork":true,"url":"https://api.github.com/repos/petertodd/bitcoin","forks_url":"https://api.github.com/repos/petertodd/bitcoin/forks","keys_url":"https://api.github.com/repos/petertodd/bitcoin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/petertodd/bitcoin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/petertodd/bitcoin/teams","hooks_url":"https://api.github.com/repos/petertodd/bitcoin/hooks","issue_events_url":"https://api.github.com/repos/petertodd/bitcoin/issues/events{/number}","events_url":"https://api.github.com/repos/petertodd/bitcoin/events","assignees_url":"https://api.github.com/repos/petertodd/bitcoin/assignees{/user}","branches_url":"https://api.github.com/repos/petertodd/bitcoin/branches{/branch}","tags_url":"https://api.github.com/repos/petertodd/bitcoin/tags","blobs_url":"https://api.github.com/repos/petertodd/bitcoin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/petertodd/bitcoin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/petertodd/bitcoin/git/refs{/sha}","trees_url":"https://api.github.com/repos/petertodd/bitcoin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/petertodd/bitcoin/statuses/{sha}","languages_url":"https://api.github.com/repos/petertodd/bitcoin/languages","stargazers_url":"https://api.github.com/repos/petertodd/bitcoin/stargazers","contributors_url":"https://api.github.com/repos/petertodd/bitcoin/contributors","subscribers_url":"https://api.github.com/repos/petertodd/bitcoin/subscribers","subscription_url":"https://api.github.com/repos/petertodd/bitcoin/subscription","commits_url":"https://api.github.com/repos/petertodd/bitcoin/commits{/sha}","git_commits_url":"https://api.github.com/repos/petertodd/bitcoin/git/commits{/sha}","comments_url":"https://api.github.com/repos/petertodd/bitcoin/comments{/number}","issue_comment_url":"https://api.github.com/repos/petertodd/bitcoin/issues/comments{/number}","contents_url":"https://api.github.com/repos/petertodd/bitcoin/contents/{+path}","compare_url":"https://api.github.com/repos/petertodd/bitcoin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/petertodd/bitcoin/merges","archive_url":"https://api.github.com/repos/petertodd/bitcoin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/petertodd/bitcoin/downloads","issues_url":"https://api.github.com/repos/petertodd/bitcoin/issues{/number}","pulls_url":"https://api.github.com/repos/petertodd/bitcoin/pulls{/number}","milestones_url":"https://api.github.com/repos/petertodd/bitcoin/milestones{/number}","notifications_url":"https://api.github.com/repos/petertodd/bitcoin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/petertodd/bitcoin/labels{/name}","releases_url":"https://api.github.com/repos/petertodd/bitcoin/releases{/id}","created_at":"2012-09-28T03:31:40Z","updated_at":"2015-07-10T20:43:06Z","pushed_at":"2015-07-20T15:20:23Z","git_url":"git://github.com/petertodd/bitcoin.git","ssh_url":"git@github.com:petertodd/bitcoin.git","clone_url":"https://github.com/petertodd/bitcoin.git","svn_url":"https://github.com/petertodd/bitcoin","homepage":"http://www.bitcoin.org","size":56439,"stargazers_count":6,"watchers_count":6,"language":"TypeScript","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":6,"default_branch":"master"}},"base":{"label":"bitcoin:master","ref":"master","sha":"89289d875da108c42ca013f33597eda46cb6eb53","user":{"login":"bitcoin","id":528860,"avatar_url":"https://avatars.githubusercontent.com/u/528860?v=3","gravatar_id":"","url":"https://api.github.com/users/bitcoin","html_url":"https://github.com/bitcoin","followers_url":"https://api.github.com/users/bitcoin/followers","following_url":"https://api.github.com/users/bitcoin/following{/other_user}","gists_url":"https://api.github.com/users/bitcoin/gists{/gist_id}","starred_url":"https://api.github.com/users/bitcoin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bitcoin/subscriptions","organizations_url":"https://api.github.com/users/bitcoin/orgs","repos_url":"https://api.github.com/users/bitcoin/repos","events_url":"https://api.github.com/users/bitcoin/events{/privacy}","received_events_url":"https://api.github.com/users/bitcoin/received_events","type":"Organization","site_admin":false},"repo":{"id":1181927,"name":"bitcoin","full_name":"bitcoin/bitcoin","owner":{"login":"bitcoin","id":528860,"avatar_url":"https://avatars.githubusercontent.com/u/528860?v=3","gravatar_id":"","url":"https://api.github.com/users/bitcoin","html_url":"https://github.com/bitcoin","followers_url":"https://api.github.com/users/bitcoin/followers","following_url":"https://api.github.com/users/bitcoin/following{/other_user}","gists_url":"https://api.github.com/users/bitcoin/gists{/gist_id}","starred_url":"https://api.github.com/users/bitcoin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bitcoin/subscriptions","organizations_url":"https://api.github.com/users/bitcoin/orgs","repos_url":"https://api.github.com/users/bitcoin/repos","events_url":"https://api.github.com/users/bitcoin/events{/privacy}","received_events_url":"https://api.github.com/users/bitcoin/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bitcoin/bitcoin","description":"Bitcoin Core integration/staging tree","fork":false,"url":"https://api.github.com/repos/bitcoin/bitcoin","forks_url":"https://api.github.com/repos/bitcoin/bitcoin/forks","keys_url":"https://api.github.com/repos/bitcoin/bitcoin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bitcoin/bitcoin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bitcoin/bitcoin/teams","hooks_url":"https://api.github.com/repos/bitcoin/bitcoin/hooks","issue_events_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/events{/number}","events_url":"https://api.github.com/repos/bitcoin/bitcoin/events","assignees_url":"https://api.github.com/repos/bitcoin/bitcoin/assignees{/user}","branches_url":"https://api.github.com/repos/bitcoin/bitcoin/branches{/branch}","tags_url":"https://api.github.com/repos/bitcoin/bitcoin/tags","blobs_url":"https://api.github.com/repos/bitcoin/bitcoin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bitcoin/bitcoin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bitcoin/bitcoin/git/refs{/sha}","trees_url":"https://api.github.com/repos/bitcoin/bitcoin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bitcoin/bitcoin/statuses/{sha}","languages_url":"https://api.github.com/repos/bitcoin/bitcoin/languages","stargazers_url":"https://api.github.com/repos/bitcoin/bitcoin/stargazers","contributors_url":"https://api.github.com/repos/bitcoin/bitcoin/contributors","subscribers_url":"https://api.github.com/repos/bitcoin/bitcoin/subscribers","subscription_url":"https://api.github.com/repos/bitcoin/bitcoin/subscription","commits_url":"https://api.github.com/repos/bitcoin/bitcoin/commits{/sha}","git_commits_url":"https://api.github.com/repos/bitcoin/bitcoin/git/commits{/sha}","comments_url":"https://api.github.com/repos/bitcoin/bitcoin/comments{/number}","issue_comment_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/comments{/number}","contents_url":"https://api.github.com/repos/bitcoin/bitcoin/contents/{+path}","compare_url":"https://api.github.com/repos/bitcoin/bitcoin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bitcoin/bitcoin/merges","archive_url":"https://api.github.com/repos/bitcoin/bitcoin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bitcoin/bitcoin/downloads","issues_url":"https://api.github.com/repos/bitcoin/bitcoin/issues{/number}","pulls_url":"https://api.github.com/repos/bitcoin/bitcoin/pulls{/number}","milestones_url":"https://api.github.com/repos/bitcoin/bitcoin/milestones{/number}","notifications_url":"https://api.github.com/repos/bitcoin/bitcoin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bitcoin/bitcoin/labels{/name}","releases_url":"https://api.github.com/repos/bitcoin/bitcoin/releases{/id}","created_at":"2010-12-19T15:16:43Z","updated_at":"2015-07-20T15:38:01Z","pushed_at":"2015-07-20T15:20:28Z","git_url":"git://github.com/bitcoin/bitcoin.git","ssh_url":"git@github.com:bitcoin/bitcoin.git","clone_url":"https://github.com/bitcoin/bitcoin.git","svn_url":"https://github.com/bitcoin/bitcoin","homepage":"https://bitcoin.org/en/download","size":130211,"stargazers_count":7203,"watchers_count":7203,"language":"C++","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":5024,"mirror_url":null,"open_issues_count":447,"forks":5024,"open_issues":447,"watchers":7203,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/6452"},"html":{"href":"https://github.com/bitcoin/bitcoin/pull/6452"},"issue":{"href":"https://api.github.com/repos/bitcoin/bitcoin/issues/6452"},"comments":{"href":"https://api.github.com/repos/bitcoin/bitcoin/issues/6452/comments"},"review_comments":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/6452/comments"},"review_comment":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/6452/commits"},"statuses":{"href":"https://api.github.com/repos/bitcoin/bitcoin/statuses/65c4c69c8504724eabb6385b3a6e917c5b85290a"}}}}