{"action":"created","comment":{"url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/34452910","id":34452910,"diff_hunk":"@@ -859,22 +859,39 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa\n         CTxMemPoolEntry entry(tx, nFees, GetTime(), dPriority, chainActive.Height(), mempool.HasNoInputsOf(tx));\n         unsigned int nSize = entry.GetTxSize();\n \n+        // Try to make space in mempool\n+        std::set<uint256> protect;\n+        BOOST_FOREACH(const CTxIn& in, tx.vin) {\n+            protect.insert(in.prevout.hash);\n+        }\n+        std::set<uint256> stagedelete;\n+        CAmount nFeesDeleted = 0;\n+        size_t nSizeDeleted = 0;\n+        if (!mempool.StageTrimToSize(GetArg(\"-maxmempool\", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000, nFees, entry.GetFeeRate(), protect, stagedelete, nFeesDeleted, nSizeDeleted)) {","path":"src/main.cpp","position":39,"original_position":39,"commit_id":"0a917df8e2c91a58fa8ed2667c867e27162b62e6","original_commit_id":"0a917df8e2c91a58fa8ed2667c867e27162b62e6","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":"It'd be better if we added the size of the new tx to the size limit, as right now the limit can be exceeded; I'm sure this is going to result in issues getting raised... GuessDynamicMemoryUsage() could be used for that if I understand its purpose correctly.","created_at":"2015-07-13T11:08:43Z","updated_at":"2015-07-13T11:08:43Z","html_url":"https://github.com/bitcoin/bitcoin/pull/6421#discussion_r34452910","pull_request_url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/6421","_links":{"self":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/34452910"},"html":{"href":"https://github.com/bitcoin/bitcoin/pull/6421#discussion_r34452910"},"pull_request":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/6421"}}},"pull_request":{"url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/6421","id":39746005,"html_url":"https://github.com/bitcoin/bitcoin/pull/6421","diff_url":"https://github.com/bitcoin/bitcoin/pull/6421.diff","patch_url":"https://github.com/bitcoin/bitcoin/pull/6421.patch","issue_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/6421","number":6421,"state":"open","locked":false,"title":"Continuously limit the memory pool memory consumption","user":{"login":"sipa","id":548488,"avatar_url":"https://avatars.githubusercontent.com/u/548488?v=3","gravatar_id":"","url":"https://api.github.com/users/sipa","html_url":"https://github.com/sipa","followers_url":"https://api.github.com/users/sipa/followers","following_url":"https://api.github.com/users/sipa/following{/other_user}","gists_url":"https://api.github.com/users/sipa/gists{/gist_id}","starred_url":"https://api.github.com/users/sipa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sipa/subscriptions","organizations_url":"https://api.github.com/users/sipa/orgs","repos_url":"https://api.github.com/users/sipa/repos","events_url":"https://api.github.com/users/sipa/events{/privacy}","received_events_url":"https://api.github.com/users/sipa/received_events","type":"User","site_admin":false},"body":"This pull request contains a squashed version of #6331 and #6410, and replaces #6281.\r\n\r\nWhenever a new transaction arrives, we check which of the lowest-feerate transactions in the mempool (including their dependencies) would have to be removed to make the memory consumption go below a configurable limit. The DoS protection relay rules then operate on the size of both the new transaction and the removed ones (as pointed out by @lapp0 in #6281).\r\n\r\nNote that:\r\n* Even though it adds a feerate index to the mempool, it does not use this index for block construction.\r\n* The mempool eviction code does not take priority into account. It strictly aims at maximizing mempool fee rate.\r\n* Untested.","created_at":"2015-07-11T13:36:10Z","updated_at":"2015-07-13T11:08:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cfb609fc971acc7bee13f96b49097324be0e595f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/6421/commits","review_comments_url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/6421/comments","review_comment_url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/6421/comments","statuses_url":"https://api.github.com/repos/bitcoin/bitcoin/statuses/0a917df8e2c91a58fa8ed2667c867e27162b62e6","head":{"label":"sipa:limitpool","ref":"limitpool","sha":"0a917df8e2c91a58fa8ed2667c867e27162b62e6","user":{"login":"sipa","id":548488,"avatar_url":"https://avatars.githubusercontent.com/u/548488?v=3","gravatar_id":"","url":"https://api.github.com/users/sipa","html_url":"https://github.com/sipa","followers_url":"https://api.github.com/users/sipa/followers","following_url":"https://api.github.com/users/sipa/following{/other_user}","gists_url":"https://api.github.com/users/sipa/gists{/gist_id}","starred_url":"https://api.github.com/users/sipa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sipa/subscriptions","organizations_url":"https://api.github.com/users/sipa/orgs","repos_url":"https://api.github.com/users/sipa/repos","events_url":"https://api.github.com/users/sipa/events{/privacy}","received_events_url":"https://api.github.com/users/sipa/received_events","type":"User","site_admin":false},"repo":{"id":1458655,"name":"bitcoin","full_name":"sipa/bitcoin","owner":{"login":"sipa","id":548488,"avatar_url":"https://avatars.githubusercontent.com/u/548488?v=3","gravatar_id":"","url":"https://api.github.com/users/sipa","html_url":"https://github.com/sipa","followers_url":"https://api.github.com/users/sipa/followers","following_url":"https://api.github.com/users/sipa/following{/other_user}","gists_url":"https://api.github.com/users/sipa/gists{/gist_id}","starred_url":"https://api.github.com/users/sipa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sipa/subscriptions","organizations_url":"https://api.github.com/users/sipa/orgs","repos_url":"https://api.github.com/users/sipa/repos","events_url":"https://api.github.com/users/sipa/events{/privacy}","received_events_url":"https://api.github.com/users/sipa/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sipa/bitcoin","description":"Bitcoin integration/staging tree","fork":true,"url":"https://api.github.com/repos/sipa/bitcoin","forks_url":"https://api.github.com/repos/sipa/bitcoin/forks","keys_url":"https://api.github.com/repos/sipa/bitcoin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sipa/bitcoin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sipa/bitcoin/teams","hooks_url":"https://api.github.com/repos/sipa/bitcoin/hooks","issue_events_url":"https://api.github.com/repos/sipa/bitcoin/issues/events{/number}","events_url":"https://api.github.com/repos/sipa/bitcoin/events","assignees_url":"https://api.github.com/repos/sipa/bitcoin/assignees{/user}","branches_url":"https://api.github.com/repos/sipa/bitcoin/branches{/branch}","tags_url":"https://api.github.com/repos/sipa/bitcoin/tags","blobs_url":"https://api.github.com/repos/sipa/bitcoin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sipa/bitcoin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sipa/bitcoin/git/refs{/sha}","trees_url":"https://api.github.com/repos/sipa/bitcoin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sipa/bitcoin/statuses/{sha}","languages_url":"https://api.github.com/repos/sipa/bitcoin/languages","stargazers_url":"https://api.github.com/repos/sipa/bitcoin/stargazers","contributors_url":"https://api.github.com/repos/sipa/bitcoin/contributors","subscribers_url":"https://api.github.com/repos/sipa/bitcoin/subscribers","subscription_url":"https://api.github.com/repos/sipa/bitcoin/subscription","commits_url":"https://api.github.com/repos/sipa/bitcoin/commits{/sha}","git_commits_url":"https://api.github.com/repos/sipa/bitcoin/git/commits{/sha}","comments_url":"https://api.github.com/repos/sipa/bitcoin/comments{/number}","issue_comment_url":"https://api.github.com/repos/sipa/bitcoin/issues/comments{/number}","contents_url":"https://api.github.com/repos/sipa/bitcoin/contents/{+path}","compare_url":"https://api.github.com/repos/sipa/bitcoin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sipa/bitcoin/merges","archive_url":"https://api.github.com/repos/sipa/bitcoin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sipa/bitcoin/downloads","issues_url":"https://api.github.com/repos/sipa/bitcoin/issues{/number}","pulls_url":"https://api.github.com/repos/sipa/bitcoin/pulls{/number}","milestones_url":"https://api.github.com/repos/sipa/bitcoin/milestones{/number}","notifications_url":"https://api.github.com/repos/sipa/bitcoin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sipa/bitcoin/labels{/name}","releases_url":"https://api.github.com/repos/sipa/bitcoin/releases{/id}","created_at":"2011-03-09T10:46:59Z","updated_at":"2015-07-04T14:49:33Z","pushed_at":"2015-07-12T20:09:27Z","git_url":"git://github.com/sipa/bitcoin.git","ssh_url":"git@github.com:sipa/bitcoin.git","clone_url":"https://github.com/sipa/bitcoin.git","svn_url":"https://github.com/sipa/bitcoin","homepage":"http://www.bitcoin.org","size":55435,"stargazers_count":25,"watchers_count":25,"language":"TypeScript","has_issues":false,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":1,"forks":5,"open_issues":1,"watchers":25,"default_branch":"lows"}},"base":{"label":"bitcoin:master","ref":"master","sha":"7cdefb927e928780cdbbb3a9b2ffe37716eebae1","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-13T05:33:16Z","pushed_at":"2015-07-13T10:55:08Z","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":130951,"stargazers_count":7173,"watchers_count":7173,"language":"C++","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":4990,"mirror_url":null,"open_issues_count":447,"forks":4990,"open_issues":447,"watchers":7173,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/6421"},"html":{"href":"https://github.com/bitcoin/bitcoin/pull/6421"},"issue":{"href":"https://api.github.com/repos/bitcoin/bitcoin/issues/6421"},"comments":{"href":"https://api.github.com/repos/bitcoin/bitcoin/issues/6421/comments"},"review_comments":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/6421/comments"},"review_comment":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/6421/commits"},"statuses":{"href":"https://api.github.com/repos/bitcoin/bitcoin/statuses/0a917df8e2c91a58fa8ed2667c867e27162b62e6"}}}}