{"action":"created","comment":{"url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/88565949","pull_request_review_id":9137405,"id":88565949,"diff_hunk":"@@ -460,12 +464,25 @@ struct CMutableTransaction\n         SerializeTransaction(*this, s, ser_action);\n     }\n \n+    template <typename Stream>\n+    CMutableTransaction(deserialize_t, Stream& s) {\n+        Unserialize(s);\n+    }\n+\n     /** Compute the hash of this CMutableTransaction. This is computed on the\n      * fly, as opposed to GetHash() in CTransaction, which uses a cached result.\n      */\n     uint256 GetHash() const;\n };\n \n+typedef std::shared_ptr<const CTransaction> CTransactionRef;\n+static inline CTransactionRef MakeTransactionRef() { return std::make_shared<const CTransaction>(); }\n+static inline CTransactionRef MakeTransactionRef(const CTransaction& txIn) { return std::make_shared<const CTransaction>(txIn); }\n+static inline CTransactionRef MakeTransactionRef(const CMutableTransaction& txIn) { return std::make_shared<const CTransaction>(txIn); }\n+static inline CTransactionRef MakeTransactionRef(CMutableTransaction&& txIn) { return std::make_shared<const CTransaction>(std::move(txIn)); }","path":"src/primitives/transaction.h","position":37,"original_position":37,"commit_id":"9bc6cbc4e24ef856ad4c803226378f276acc14ff","original_commit_id":"9bc6cbc4e24ef856ad4c803226378f276acc14ff","user":{"login":"jtimon","id":1008458,"avatar_url":"https://avatars.githubusercontent.com/u/1008458?v=3","gravatar_id":"","url":"https://api.github.com/users/jtimon","html_url":"https://github.com/jtimon","followers_url":"https://api.github.com/users/jtimon/followers","following_url":"https://api.github.com/users/jtimon/following{/other_user}","gists_url":"https://api.github.com/users/jtimon/gists{/gist_id}","starred_url":"https://api.github.com/users/jtimon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jtimon/subscriptions","organizations_url":"https://api.github.com/users/jtimon/orgs","repos_url":"https://api.github.com/users/jtimon/repos","events_url":"https://api.github.com/users/jtimon/events{/privacy}","received_events_url":"https://api.github.com/users/jtimon/received_events","type":"User","site_admin":false},"body":"Where is this version used? I see calls that call std::move before calling that maybe should be using this instead?\r\n\r\nIn any case, it doesn't feel right to have so many versions of the function somehow. Specially one some with & and others with &&","created_at":"2016-11-17T22:55:17Z","updated_at":"2016-11-17T22:55:17Z","html_url":"https://github.com/bitcoin/bitcoin/pull/9125#discussion_r88565949","pull_request_url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/9125","_links":{"self":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/88565949"},"html":{"href":"https://github.com/bitcoin/bitcoin/pull/9125#discussion_r88565949"},"pull_request":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/9125"}}},"pull_request":{"url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/9125","id":93267049,"html_url":"https://github.com/bitcoin/bitcoin/pull/9125","diff_url":"https://github.com/bitcoin/bitcoin/pull/9125.diff","patch_url":"https://github.com/bitcoin/bitcoin/pull/9125.patch","issue_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/9125","number":9125,"state":"open","locked":false,"title":"Make CBlock a vector of shared_ptr of CTransactions","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 is another preparation for #8580, avoiding performance problems and large code changes ahead of time (I was originally planning to do these afterwards, but that would temporarily introduce extra complexity).\r\n\r\nIn many places we've started using `std::shared_ptr<const CTransaction>` instead of `CTransaction` itself, as transactions are shared between many data structures (orphan pool, mempool, relay pool, partially-reconstructed transactions, ...), but a notable exception was `CBlock`, which so far always required a full copy in and out. If CTransaction is to become immutable, that will make things even worse when modifying the coinbase (https://github.com/bitcoin/bitcoin/pull/8580#issuecomment-243052533).\r\n\r\nAdvantages:\r\n* The mining code no longer needs to create a deep copy of all transactions; the resulting CBlockTemplate just shares transactions with the mempool they're taken from.\r\n* Compact block reconstruction no longer copies transactions (not from the prefilled structure to the internal partial block, and not from the partial block to the full block).\r\n* Block processing no longer copies full transactions to txChanged.\r\n* CTransaction becomes constructable-from-serialization, preparing for #8580.\r\n\r\nDisadvantages:\r\n* An extra pointer indirection and atomic increments/decrements in some places.\r\n\r\n","created_at":"2016-11-11T01:58:40Z","updated_at":"2016-11-17T22:55:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d91d6688d9601542a82df326c69c2910a18066da","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/9125/commits","review_comments_url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/9125/comments","review_comment_url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/9125/comments","statuses_url":"https://api.github.com/repos/bitcoin/bitcoin/statuses/9bc6cbc4e24ef856ad4c803226378f276acc14ff","head":{"label":"sipa:sharedblock","ref":"sharedblock","sha":"9bc6cbc4e24ef856ad4c803226378f276acc14ff","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}","deployments_url":"https://api.github.com/repos/sipa/bitcoin/deployments","created_at":"2011-03-09T10:46:59Z","updated_at":"2016-11-13T13:21:48Z","pushed_at":"2016-11-15T04:15:32Z","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":75510,"stargazers_count":51,"watchers_count":51,"language":"TypeScript","has_issues":true,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":14,"forks":12,"open_issues":14,"watchers":51,"default_branch":"lows"}},"base":{"label":"bitcoin:master","ref":"master","sha":"b42291334651fff46dbfe5947a726f65cb9d7dfe","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}","deployments_url":"https://api.github.com/repos/bitcoin/bitcoin/deployments","created_at":"2010-12-19T15:16:43Z","updated_at":"2016-11-17T20:36:43Z","pushed_at":"2016-11-17T21:23:58Z","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":160427,"stargazers_count":10450,"watchers_count":10450,"language":"C++","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":6883,"mirror_url":null,"open_issues_count":515,"forks":6883,"open_issues":515,"watchers":10450,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/9125"},"html":{"href":"https://github.com/bitcoin/bitcoin/pull/9125"},"issue":{"href":"https://api.github.com/repos/bitcoin/bitcoin/issues/9125"},"comments":{"href":"https://api.github.com/repos/bitcoin/bitcoin/issues/9125/comments"},"review_comments":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/9125/comments"},"review_comment":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/9125/commits"},"statuses":{"href":"https://api.github.com/repos/bitcoin/bitcoin/statuses/9bc6cbc4e24ef856ad4c803226378f276acc14ff"}}}}
{"actor":{"display_login":"jtimon"}}