GitHub PullRequestReviewCommentEvent at 2014-07-01 18:43:45
Repository: mastercore
Actor: m21
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/mastercoin-MSC/mastercore/pulls/comments/14421981","id":14421981,"diff_hunk":"@@ -1920,34 +1921,58 @@ const int max_block = GetHeight();\n \n int input_msc_balances_string(const string &s)\n {\n-uint64_t  uValue = 0, uSellReserved = 0, uAcceptReserved = 0;\n-std::vector<std::string> vstr;\n-boost::split(vstr, s, boost::is_any_of(\" ,=\"), token_compress_on);\n-int i = 0;\n-string strAddress = vstr[0];\n+  std::vector<std::string> addrData;\n+  boost::split(addrData, s, boost::is_any_of(\"=\"), token_compress_on);\n+  if (addrData.size() != 2) {\n+    return -1;\n+  }\n \n-//  if (msc_debug4) { BOOST_FOREACH(const string &debug_str, vstr) printf(\"%s\\n\", debug_str.c_str()); }\n+  string strAddress = addrData[0];\n \n-  ++i;\n+  // split the tuples of currencies\n+  std::vector<std::string> vCurrencies;\n+  boost::split(vCurrencies, addrData[1], boost::is_any_of(\";\"), token_compress_on);\n \n-  uValue = boost::lexical_cast<boost::uint64_t>(vstr[i++]);\n-  uSellReserved = boost::lexical_cast<boost::uint64_t>(vstr[i++]);\n-  if (vstr.size() > 3) { // FIXME: need to add accepted reserve in here from preseed !\n-    uAcceptReserved = boost::lexical_cast<boost::uint64_t>(vstr[i++]);\n-  }\n-  \n-  // want to bypass 0-value addresses...\n-  if ((0 == uValue) && (0 == uSellReserved) && (0 == uAcceptReserved)) return 0;\n+  std::vector<std::string>::const_iterator iter;\n+  for (iter = vCurrencies.begin(); iter != vCurrencies.end(); ++iter) {\n+    if ((*iter).empty()) {\n+      continue;\n+    }\n \n-  // ignoring TMSC for now...\n-  update_tally_map(strAddress, MASTERCOIN_CURRENCY_MSC, uValue, MONEY);\n+    std::vector<std::string> curData;\n+    boost::split(curData, *iter, boost::is_any_of(\",\"), token_compress_on);\n+    if (curData.size() < 1) {\n+      // malformed currency entry\n+       return -1;\n+    }\n \n-#ifdef  MY_TMSC_HACK\n-  update_tally_map(strAddress, MASTERCOIN_CURRENCY_TMSC, uValue, MONEY);\n-#endif\n+    size_t delimPos = curData[0].find(':');\n+    int currency = MASTERCOIN_CURRENCY_MSC;\n+    uint64_t balance = 0, sellReserved = 0, acceptReserved;","path":"src/mastercore.cpp","position":59,"original_position":59,"commit_id":"f39aeb98edea50acd58ce522463a7395549fba75","original_commit_id":"f39aeb98edea50acd58ce522463a7395549fba75","user":{"login":"m21","id":7240324,"avatar_url":"https://avatars.githubusercontent.com/u/7240324?","gravatar_id":"68bdeef3fc2dd699498c60afee49efe5","url":"https://api.github.com/users/m21","html_url":"https://github.com/m21","followers_url":"https://api.github.com/users/m21/followers","following_url":"https://api.github.com/users/m21/following{/other_user}","gists_url":"https://api.github.com/users/m21/gists{/gist_id}","starred_url":"https://api.github.com/users/m21/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m21/subscriptions","organizations_url":"https://api.github.com/users/m21/orgs","repos_url":"https://api.github.com/users/m21/repos","events_url":"https://api.github.com/users/m21/events{/privacy}","received_events_url":"https://api.github.com/users/m21/received_events","type":"User","site_admin":false},"body":"initialize acceptReserved to 0 as wel\r\n","created_at":"2014-07-01T18:43:45Z","updated_at":"2014-07-01T18:43:45Z","html_url":"https://github.com/mastercoin-MSC/mastercore/pull/45#discussion_r14421981","pull_request_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/pulls/45","_links":{"self":{"href":"https://api.github.com/repos/mastercoin-MSC/mastercore/pulls/comments/14421981"},"html":{"href":"https://github.com/mastercoin-MSC/mastercore/pull/45#discussion_r14421981"},"pull_request":{"href":"https://api.github.com/repos/mastercoin-MSC/mastercore/pulls/45"}}},"pull_request":{"url":"https://api.github.com/repos/mastercoin-MSC/mastercore/pulls/45","id":17811379,"html_url":"https://github.com/mastercoin-MSC/mastercore/pull/45","diff_url":"https://github.com/mastercoin-MSC/mastercore/pull/45.diff","patch_url":"https://github.com/mastercoin-MSC/mastercore/pull/45.patch","issue_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/issues/45","number":45,"state":"open","title":"modified balances.dat format to provide for multiple currencies","user":{"login":"wanderingbort","id":2494946,"avatar_url":"https://avatars.githubusercontent.com/u/2494946?","gravatar_id":"785ecd6187a1aa1936dd8364b9857486","url":"https://api.github.com/users/wanderingbort","html_url":"https://github.com/wanderingbort","followers_url":"https://api.github.com/users/wanderingbort/followers","following_url":"https://api.github.com/users/wanderingbort/following{/other_user}","gists_url":"https://api.github.com/users/wanderingbort/gists{/gist_id}","starred_url":"https://api.github.com/users/wanderingbort/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wanderingbort/subscriptions","organizations_url":"https://api.github.com/users/wanderingbort/orgs","repos_url":"https://api.github.com/users/wanderingbort/repos","events_url":"https://api.github.com/users/wanderingbort/events{/privacy}","received_events_url":"https://api.github.com/users/wanderingbort/received_events","type":"User","site_admin":false},"body":"I have not fully tested this, but it did work in prelim tests... I should really work out some unit tests for persistence using regtest mode.\r\n\r\n","created_at":"2014-07-01T04:16:03Z","updated_at":"2014-07-01T18:43:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3f5969a187ea2a07380de0689fef94907a1ac784","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/pulls/45/commits","review_comments_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/pulls/45/comments","review_comment_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/pulls/comments/{number}","comments_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/issues/45/comments","statuses_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/statuses/f39aeb98edea50acd58ce522463a7395549fba75","head":{"label":"wanderingbort:persistence-multicurrency-support","ref":"persistence-multicurrency-support","sha":"f39aeb98edea50acd58ce522463a7395549fba75","user":{"login":"wanderingbort","id":2494946,"avatar_url":"https://avatars.githubusercontent.com/u/2494946?","gravatar_id":"785ecd6187a1aa1936dd8364b9857486","url":"https://api.github.com/users/wanderingbort","html_url":"https://github.com/wanderingbort","followers_url":"https://api.github.com/users/wanderingbort/followers","following_url":"https://api.github.com/users/wanderingbort/following{/other_user}","gists_url":"https://api.github.com/users/wanderingbort/gists{/gist_id}","starred_url":"https://api.github.com/users/wanderingbort/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wanderingbort/subscriptions","organizations_url":"https://api.github.com/users/wanderingbort/orgs","repos_url":"https://api.github.com/users/wanderingbort/repos","events_url":"https://api.github.com/users/wanderingbort/events{/privacy}","received_events_url":"https://api.github.com/users/wanderingbort/received_events","type":"User","site_admin":false},"repo":{"id":20864588,"name":"mastercore","full_name":"wanderingbort/mastercore","owner":{"login":"wanderingbort","id":2494946,"avatar_url":"https://avatars.githubusercontent.com/u/2494946?","gravatar_id":"785ecd6187a1aa1936dd8364b9857486","url":"https://api.github.com/users/wanderingbort","html_url":"https://github.com/wanderingbort","followers_url":"https://api.github.com/users/wanderingbort/followers","following_url":"https://api.github.com/users/wanderingbort/following{/other_user}","gists_url":"https://api.github.com/users/wanderingbort/gists{/gist_id}","starred_url":"https://api.github.com/users/wanderingbort/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wanderingbort/subscriptions","organizations_url":"https://api.github.com/users/wanderingbort/orgs","repos_url":"https://api.github.com/users/wanderingbort/repos","events_url":"https://api.github.com/users/wanderingbort/events{/privacy}","received_events_url":"https://api.github.com/users/wanderingbort/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wanderingbort/mastercore","description":"mastercore info","fork":true,"url":"https://api.github.com/repos/wanderingbort/mastercore","forks_url":"https://api.github.com/repos/wanderingbort/mastercore/forks","keys_url":"https://api.github.com/repos/wanderingbort/mastercore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wanderingbort/mastercore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wanderingbort/mastercore/teams","hooks_url":"https://api.github.com/repos/wanderingbort/mastercore/hooks","issue_events_url":"https://api.github.com/repos/wanderingbort/mastercore/issues/events{/number}","events_url":"https://api.github.com/repos/wanderingbort/mastercore/events","assignees_url":"https://api.github.com/repos/wanderingbort/mastercore/assignees{/user}","branches_url":"https://api.github.com/repos/wanderingbort/mastercore/branches{/branch}","tags_url":"https://api.github.com/repos/wanderingbort/mastercore/tags","blobs_url":"https://api.github.com/repos/wanderingbort/mastercore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wanderingbort/mastercore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wanderingbort/mastercore/git/refs{/sha}","trees_url":"https://api.github.com/repos/wanderingbort/mastercore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wanderingbort/mastercore/statuses/{sha}","languages_url":"https://api.github.com/repos/wanderingbort/mastercore/languages","stargazers_url":"https://api.github.com/repos/wanderingbort/mastercore/stargazers","contributors_url":"https://api.github.com/repos/wanderingbort/mastercore/contributors","subscribers_url":"https://api.github.com/repos/wanderingbort/mastercore/subscribers","subscription_url":"https://api.github.com/repos/wanderingbort/mastercore/subscription","commits_url":"https://api.github.com/repos/wanderingbort/mastercore/commits{/sha}","git_commits_url":"https://api.github.com/repos/wanderingbort/mastercore/git/commits{/sha}","comments_url":"https://api.github.com/repos/wanderingbort/mastercore/comments{/number}","issue_comment_url":"https://api.github.com/repos/wanderingbort/mastercore/issues/comments/{number}","contents_url":"https://api.github.com/repos/wanderingbort/mastercore/contents/{+path}","compare_url":"https://api.github.com/repos/wanderingbort/mastercore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wanderingbort/mastercore/merges","archive_url":"https://api.github.com/repos/wanderingbort/mastercore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wanderingbort/mastercore/downloads","issues_url":"https://api.github.com/repos/wanderingbort/mastercore/issues{/number}","pulls_url":"https://api.github.com/repos/wanderingbort/mastercore/pulls{/number}","milestones_url":"https://api.github.com/repos/wanderingbort/mastercore/milestones{/number}","notifications_url":"https://api.github.com/repos/wanderingbort/mastercore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wanderingbort/mastercore/labels{/name}","releases_url":"https://api.github.com/repos/wanderingbort/mastercore/releases{/id}","created_at":"2014-06-15T20:26:05Z","updated_at":"2014-06-19T22:50:20Z","pushed_at":"2014-07-01T04:15:13Z","git_url":"git://github.com/wanderingbort/mastercore.git","ssh_url":"git@github.com:wanderingbort/mastercore.git","clone_url":"https://github.com/wanderingbort/mastercore.git","svn_url":"https://github.com/wanderingbort/mastercore","homepage":"mastercoin.org","size":27618,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","has_issues":false,"has_downloads":false,"has_wiki":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"michael"}},"base":{"label":"mastercoin-MSC:michael","ref":"michael","sha":"81027e11c2cb0c4e893b077f43b6327f9c79b4db","user":{"login":"mastercoin-MSC","id":5316249,"avatar_url":"https://avatars.githubusercontent.com/u/5316249?","gravatar_id":"b2f86f86fc216f0e47b3ed336528c865","url":"https://api.github.com/users/mastercoin-MSC","html_url":"https://github.com/mastercoin-MSC","followers_url":"https://api.github.com/users/mastercoin-MSC/followers","following_url":"https://api.github.com/users/mastercoin-MSC/following{/other_user}","gists_url":"https://api.github.com/users/mastercoin-MSC/gists{/gist_id}","starred_url":"https://api.github.com/users/mastercoin-MSC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mastercoin-MSC/subscriptions","organizations_url":"https://api.github.com/users/mastercoin-MSC/orgs","repos_url":"https://api.github.com/users/mastercoin-MSC/repos","events_url":"https://api.github.com/users/mastercoin-MSC/events{/privacy}","received_events_url":"https://api.github.com/users/mastercoin-MSC/received_events","type":"Organization","site_admin":false},"repo":{"id":19974650,"name":"mastercore","full_name":"mastercoin-MSC/mastercore","owner":{"login":"mastercoin-MSC","id":5316249,"avatar_url":"https://avatars.githubusercontent.com/u/5316249?","gravatar_id":"b2f86f86fc216f0e47b3ed336528c865","url":"https://api.github.com/users/mastercoin-MSC","html_url":"https://github.com/mastercoin-MSC","followers_url":"https://api.github.com/users/mastercoin-MSC/followers","following_url":"https://api.github.com/users/mastercoin-MSC/following{/other_user}","gists_url":"https://api.github.com/users/mastercoin-MSC/gists{/gist_id}","starred_url":"https://api.github.com/users/mastercoin-MSC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mastercoin-MSC/subscriptions","organizations_url":"https://api.github.com/users/mastercoin-MSC/orgs","repos_url":"https://api.github.com/users/mastercoin-MSC/repos","events_url":"https://api.github.com/users/mastercoin-MSC/events{/privacy}","received_events_url":"https://api.github.com/users/mastercoin-MSC/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mastercoin-MSC/mastercore","description":"mastercore info","fork":true,"url":"https://api.github.com/repos/mastercoin-MSC/mastercore","forks_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/forks","keys_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/teams","hooks_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/hooks","issue_events_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/issues/events{/number}","events_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/events","assignees_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/assignees{/user}","branches_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/branches{/branch}","tags_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/tags","blobs_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/git/refs{/sha}","trees_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/statuses/{sha}","languages_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/languages","stargazers_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/stargazers","contributors_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/contributors","subscribers_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/subscribers","subscription_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/subscription","commits_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/commits{/sha}","git_commits_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/git/commits{/sha}","comments_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/comments{/number}","issue_comment_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/issues/comments/{number}","contents_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/contents/{+path}","compare_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/merges","archive_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/downloads","issues_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/issues{/number}","pulls_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/pulls{/number}","milestones_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/milestones{/number}","notifications_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/labels{/name}","releases_url":"https://api.github.com/repos/mastercoin-MSC/mastercore/releases{/id}","created_at":"2014-05-20T09:10:51Z","updated_at":"2014-06-25T23:20:08Z","pushed_at":"2014-07-01T04:05:38Z","git_url":"git://github.com/mastercoin-MSC/mastercore.git","ssh_url":"git@github.com:mastercoin-MSC/mastercore.git","clone_url":"https://github.com/mastercoin-MSC/mastercore.git","svn_url":"https://github.com/mastercoin-MSC/mastercore","homepage":"mastercoin.org","size":29034,"stargazers_count":5,"watchers_count":5,"language":"TypeScript","has_issues":true,"has_downloads":false,"has_wiki":true,"forks_count":2,"mirror_url":null,"open_issues_count":9,"forks":2,"open_issues":9,"watchers":5,"default_branch":"michael"}},"_links":{"self":{"href":"https://api.github.com/repos/mastercoin-MSC/mastercore/pulls/45"},"html":{"href":"https://github.com/mastercoin-MSC/mastercore/pull/45"},"issue":{"href":"https://api.github.com/repos/mastercoin-MSC/mastercore/issues/45"},"comments":{"href":"https://api.github.com/repos/mastercoin-MSC/mastercore/issues/45/comments"},"review_comments":{"href":"https://api.github.com/repos/mastercoin-MSC/mastercore/pulls/45/comments"},"review_comment":{"href":"https://api.github.com/repos/mastercoin-MSC/mastercore/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/mastercoin-MSC/mastercore/pulls/45/commits"},"statuses":{"href":"https://api.github.com/repos/mastercoin-MSC/mastercore/statuses/f39aeb98edea50acd58ce522463a7395549fba75"}}}}