{"action":"created","comment":{"url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/192603399","pull_request_review_id":125409144,"id":192603399,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5MjYwMzM5OQ==","diff_hunk":"@@ -151,9 +151,12 @@ UniValue importprivkey(const JSONRPCRequest& request)\n         CKeyID vchAddress = pubkey.GetID();\n         {\n             pwallet->MarkDirty();\n-            // We don't know which corresponding address will be used; label them all\n+\n+            // We don't know which corresponding address will be used; label all new addresses and preserve the rest\n             for (const auto& dest : GetAllDestinationsForKey(pubkey)) {\n-                pwallet->SetAddressBook(dest, strLabel, \"receive\");\n+                bool has_label = pwallet->mapAddressBook.find(dest) != pwallet->mapAddressBook.end() && !pwallet->mapAddressBook[dest].name.empty();","path":"src/wallet/rpcdump.cpp","position":18,"original_position":18,"commit_id":"c74740701d5b3d99380b9bf4fe329cdb4f6c235b","original_commit_id":"c74740701d5b3d99380b9bf4fe329cdb4f6c235b","user":{"login":"promag","id":3534524,"node_id":"MDQ6VXNlcjM1MzQ1MjQ=","avatar_url":"https://avatars1.githubusercontent.com/u/3534524?v=4","gravatar_id":"","url":"https://api.github.com/users/promag","html_url":"https://github.com/promag","followers_url":"https://api.github.com/users/promag/followers","following_url":"https://api.github.com/users/promag/following{/other_user}","gists_url":"https://api.github.com/users/promag/gists{/gist_id}","starred_url":"https://api.github.com/users/promag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/promag/subscriptions","organizations_url":"https://api.github.com/users/promag/orgs","repos_url":"https://api.github.com/users/promag/repos","events_url":"https://api.github.com/users/promag/events{/privacy}","received_events_url":"https://api.github.com/users/promag/received_events","type":"User","site_admin":false},"body":"I was thinking in something like\r\n```cpp\r\nif (request.params[1].isNull()) {\r\n    const auto& it = pwallet->mapAddressBook.find(dest);\r\n    if (it != pwallet->mapAddressBook.end()) strLabel = it->second;\r\n}\r\npwallet->SetAddressBook(dest, strLabel, \"receive\");\r\n```","created_at":"2018-06-03T21:42:00Z","updated_at":"2018-06-03T21:42:00Z","html_url":"https://github.com/bitcoin/bitcoin/pull/13381#discussion_r192603399","pull_request_url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/13381","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/comments/192603399"},"html":{"href":"https://github.com/bitcoin/bitcoin/pull/13381#discussion_r192603399"},"pull_request":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/13381"}}},"pull_request":{"url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/13381","id":192251755,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkyMjUxNzU1","html_url":"https://github.com/bitcoin/bitcoin/pull/13381","diff_url":"https://github.com/bitcoin/bitcoin/pull/13381.diff","patch_url":"https://github.com/bitcoin/bitcoin/pull/13381.patch","issue_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/13381","number":13381,"state":"open","locked":false,"title":"RPC: creates preserve parameter for importprivkey call","user":{"login":"marcoagner","id":5016303,"node_id":"MDQ6VXNlcjUwMTYzMDM=","avatar_url":"https://avatars0.githubusercontent.com/u/5016303?v=4","gravatar_id":"","url":"https://api.github.com/users/marcoagner","html_url":"https://github.com/marcoagner","followers_url":"https://api.github.com/users/marcoagner/followers","following_url":"https://api.github.com/users/marcoagner/following{/other_user}","gists_url":"https://api.github.com/users/marcoagner/gists{/gist_id}","starred_url":"https://api.github.com/users/marcoagner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcoagner/subscriptions","organizations_url":"https://api.github.com/users/marcoagner/orgs","repos_url":"https://api.github.com/users/marcoagner/repos","events_url":"https://api.github.com/users/marcoagner/events{/privacy}","received_events_url":"https://api.github.com/users/marcoagner/received_events","type":"User","site_admin":false},"body":"Closes #13087.\r\n\r\nSince, as discussed in the issue, this is a feature request instead of a bug report since the behavior was as intended (i.e. label with default: `''`), I added a `preserve` bool (default: `false`) to importprivkey call so the old behavior is kept while the possibility to achieve the preservation of labels as expected in the open issue is added.\r\n\r\nIf this approach seems fine and I'm not missing anything critical, I will add tests for this.\r\nAlso, if acceptable, something similar can be implemented for importmulti on this or other PR.","created_at":"2018-06-03T14:59:52Z","updated_at":"2018-06-03T21:42:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"856e6dfa0ced5ce8e5ee0fc4a0fc5303dad96e9b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":98279177,"node_id":"MDU6TGFiZWw5ODI3OTE3Nw==","url":"https://api.github.com/repos/bitcoin/bitcoin/labels/RPC/REST/ZMQ","name":"RPC/REST/ZMQ","color":"0052cc","default":false},{"id":149424,"node_id":"MDU6TGFiZWwxNDk0MjQ=","url":"https://api.github.com/repos/bitcoin/bitcoin/labels/Wallet","name":"Wallet","color":"08a781","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/13381/commits","review_comments_url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/13381/comments","review_comment_url":"https://api.github.com/repos/bitcoin/bitcoin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/13381/comments","statuses_url":"https://api.github.com/repos/bitcoin/bitcoin/statuses/c74740701d5b3d99380b9bf4fe329cdb4f6c235b","head":{"label":"marcoagner:feature_preserve_labels_on_import","ref":"feature_preserve_labels_on_import","sha":"c74740701d5b3d99380b9bf4fe329cdb4f6c235b","user":{"login":"marcoagner","id":5016303,"node_id":"MDQ6VXNlcjUwMTYzMDM=","avatar_url":"https://avatars0.githubusercontent.com/u/5016303?v=4","gravatar_id":"","url":"https://api.github.com/users/marcoagner","html_url":"https://github.com/marcoagner","followers_url":"https://api.github.com/users/marcoagner/followers","following_url":"https://api.github.com/users/marcoagner/following{/other_user}","gists_url":"https://api.github.com/users/marcoagner/gists{/gist_id}","starred_url":"https://api.github.com/users/marcoagner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcoagner/subscriptions","organizations_url":"https://api.github.com/users/marcoagner/orgs","repos_url":"https://api.github.com/users/marcoagner/repos","events_url":"https://api.github.com/users/marcoagner/events{/privacy}","received_events_url":"https://api.github.com/users/marcoagner/received_events","type":"User","site_admin":false},"repo":{"id":127415290,"node_id":"MDEwOlJlcG9zaXRvcnkxMjc0MTUyOTA=","name":"bitcoin","full_name":"marcoagner/bitcoin","owner":{"login":"marcoagner","id":5016303,"node_id":"MDQ6VXNlcjUwMTYzMDM=","avatar_url":"https://avatars0.githubusercontent.com/u/5016303?v=4","gravatar_id":"","url":"https://api.github.com/users/marcoagner","html_url":"https://github.com/marcoagner","followers_url":"https://api.github.com/users/marcoagner/followers","following_url":"https://api.github.com/users/marcoagner/following{/other_user}","gists_url":"https://api.github.com/users/marcoagner/gists{/gist_id}","starred_url":"https://api.github.com/users/marcoagner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcoagner/subscriptions","organizations_url":"https://api.github.com/users/marcoagner/orgs","repos_url":"https://api.github.com/users/marcoagner/repos","events_url":"https://api.github.com/users/marcoagner/events{/privacy}","received_events_url":"https://api.github.com/users/marcoagner/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/marcoagner/bitcoin","description":"Bitcoin Core integration/staging tree","fork":true,"url":"https://api.github.com/repos/marcoagner/bitcoin","forks_url":"https://api.github.com/repos/marcoagner/bitcoin/forks","keys_url":"https://api.github.com/repos/marcoagner/bitcoin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/marcoagner/bitcoin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/marcoagner/bitcoin/teams","hooks_url":"https://api.github.com/repos/marcoagner/bitcoin/hooks","issue_events_url":"https://api.github.com/repos/marcoagner/bitcoin/issues/events{/number}","events_url":"https://api.github.com/repos/marcoagner/bitcoin/events","assignees_url":"https://api.github.com/repos/marcoagner/bitcoin/assignees{/user}","branches_url":"https://api.github.com/repos/marcoagner/bitcoin/branches{/branch}","tags_url":"https://api.github.com/repos/marcoagner/bitcoin/tags","blobs_url":"https://api.github.com/repos/marcoagner/bitcoin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/marcoagner/bitcoin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/marcoagner/bitcoin/git/refs{/sha}","trees_url":"https://api.github.com/repos/marcoagner/bitcoin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/marcoagner/bitcoin/statuses/{sha}","languages_url":"https://api.github.com/repos/marcoagner/bitcoin/languages","stargazers_url":"https://api.github.com/repos/marcoagner/bitcoin/stargazers","contributors_url":"https://api.github.com/repos/marcoagner/bitcoin/contributors","subscribers_url":"https://api.github.com/repos/marcoagner/bitcoin/subscribers","subscription_url":"https://api.github.com/repos/marcoagner/bitcoin/subscription","commits_url":"https://api.github.com/repos/marcoagner/bitcoin/commits{/sha}","git_commits_url":"https://api.github.com/repos/marcoagner/bitcoin/git/commits{/sha}","comments_url":"https://api.github.com/repos/marcoagner/bitcoin/comments{/number}","issue_comment_url":"https://api.github.com/repos/marcoagner/bitcoin/issues/comments{/number}","contents_url":"https://api.github.com/repos/marcoagner/bitcoin/contents/{+path}","compare_url":"https://api.github.com/repos/marcoagner/bitcoin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/marcoagner/bitcoin/merges","archive_url":"https://api.github.com/repos/marcoagner/bitcoin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/marcoagner/bitcoin/downloads","issues_url":"https://api.github.com/repos/marcoagner/bitcoin/issues{/number}","pulls_url":"https://api.github.com/repos/marcoagner/bitcoin/pulls{/number}","milestones_url":"https://api.github.com/repos/marcoagner/bitcoin/milestones{/number}","notifications_url":"https://api.github.com/repos/marcoagner/bitcoin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/marcoagner/bitcoin/labels{/name}","releases_url":"https://api.github.com/repos/marcoagner/bitcoin/releases{/id}","deployments_url":"https://api.github.com/repos/marcoagner/bitcoin/deployments","created_at":"2018-03-30T10:26:15Z","updated_at":"2018-05-30T09:48:03Z","pushed_at":"2018-06-03T21:14:06Z","git_url":"git://github.com/marcoagner/bitcoin.git","ssh_url":"git@github.com:marcoagner/bitcoin.git","clone_url":"https://github.com/marcoagner/bitcoin.git","svn_url":"https://github.com/marcoagner/bitcoin","homepage":"https://bitcoin.org/en/download","size":100681,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"bitcoin:master","ref":"master","sha":"e24bf1ce184bc8d5bba70a3f3e9c43c2df07f4d3","user":{"login":"bitcoin","id":528860,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUyODg2MA==","avatar_url":"https://avatars2.githubusercontent.com/u/528860?v=4","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,"node_id":"MDEwOlJlcG9zaXRvcnkxMTgxOTI3","name":"bitcoin","full_name":"bitcoin/bitcoin","owner":{"login":"bitcoin","id":528860,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUyODg2MA==","avatar_url":"https://avatars2.githubusercontent.com/u/528860?v=4","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":"2018-06-03T21:37:08Z","pushed_at":"2018-06-03T21:14:09Z","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":103216,"stargazers_count":32073,"watchers_count":32073,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":19322,"mirror_url":null,"archived":false,"open_issues_count":812,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":19322,"open_issues":812,"watchers":32073,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/13381"},"html":{"href":"https://github.com/bitcoin/bitcoin/pull/13381"},"issue":{"href":"https://api.github.com/repos/bitcoin/bitcoin/issues/13381"},"comments":{"href":"https://api.github.com/repos/bitcoin/bitcoin/issues/13381/comments"},"review_comments":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/13381/comments"},"review_comment":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bitcoin/bitcoin/pulls/13381/commits"},"statuses":{"href":"https://api.github.com/repos/bitcoin/bitcoin/statuses/c74740701d5b3d99380b9bf4fe329cdb4f6c235b"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"promag"}}