{"action":"created","comment":{"url":"https://api.github.com/repos/ripple/rippled/pulls/comments/31576616","id":31576616,"diff_hunk":"@@ -0,0 +1,217 @@\n+//------------------------------------------------------------------------------\n+/*\n+  This file is part of rippled: https://github.com/ripple/rippled\n+  Copyright (c) 2012-2015 Ripple Labs Inc.\n+\n+  Permission to use, copy, modify, and/or distribute this software for any\n+  purpose  with  or without fee is hereby granted, provided that the above\n+  copyright notice and this permission notice appear in all copies.\n+\n+  THE  SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n+  WITH  REGARD  TO  THIS  SOFTWARE  INCLUDING  ALL  IMPLIED  WARRANTIES  OF\n+  MERCHANTABILITY  AND  FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n+  ANY  SPECIAL ,  DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n+  WHATSOEVER  RESULTING  FROM  LOSS  OF USE, DATA OR PROFITS, WHETHER IN AN\n+  ACTION  OF  CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n+  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n+*/\n+//==============================================================================\n+\n+#include <BeastConfig.h>\n+#include <ripple/app/tests/Env.h>\n+#include <ripple/app/paths/FindPaths.h>\n+#include <ripple/app/tx/TransactionEngine.h>\n+#include <ripple/basics/Slice.h>\n+#include <ripple/json/to_string.h>\n+#include <ripple/protocol/ErrorCodes.h>\n+#include <ripple/protocol/HashPrefix.h>\n+#include <ripple/protocol/JsonFields.h>\n+#include <ripple/protocol/LedgerFormats.h>\n+#include <ripple/protocol/Serializer.h>\n+#include <ripple/protocol/STParsedJSON.h>\n+#include <ripple/protocol/SystemParameters.h>\n+#include <ripple/protocol/TER.h>\n+#include <ripple/protocol/TxFlags.h>\n+// VFALCO TODO Use AnyPublicKey, AnySecretKey, AccountID\n+\n+namespace ripple {\n+namespace test {\n+\n+STAmount\n+AccountInfo::balance(\n+    Issue const& issue) const\n+{\n+    if (isXRP(issue))\n+        return root_->getFieldAmount(sfBalance);","path":"src/ripple/app/tests/Env.cpp","position":45,"original_position":45,"commit_id":"afdd80a45c35a1b8b94de4cd595d1bfdfe8d3f75","original_commit_id":"afdd80a45c35a1b8b94de4cd595d1bfdfe8d3f75","user":{"login":"ximinez","id":6757714,"avatar_url":"https://avatars.githubusercontent.com/u/6757714?v=3","gravatar_id":"","url":"https://api.github.com/users/ximinez","html_url":"https://github.com/ximinez","followers_url":"https://api.github.com/users/ximinez/followers","following_url":"https://api.github.com/users/ximinez/following{/other_user}","gists_url":"https://api.github.com/users/ximinez/gists{/gist_id}","starred_url":"https://api.github.com/users/ximinez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ximinez/subscriptions","organizations_url":"https://api.github.com/users/ximinez/orgs","repos_url":"https://api.github.com/users/ximinez/repos","events_url":"https://api.github.com/users/ximinez/events{/privacy}","received_events_url":"https://api.github.com/users/ximinez/received_events","type":"User","site_admin":false},"body":"If you try to get the `balance` (or really any other info) of an unfunded account, `root_` will be null, which will cause an exception to be thrown. Is this intentional, or should these functions be checking `root_` first?","created_at":"2015-06-02T22:08:07Z","updated_at":"2015-06-02T22:08:07Z","html_url":"https://github.com/ripple/rippled/pull/1090#discussion_r31576616","pull_request_url":"https://api.github.com/repos/ripple/rippled/pulls/1090","_links":{"self":{"href":"https://api.github.com/repos/ripple/rippled/pulls/comments/31576616"},"html":{"href":"https://github.com/ripple/rippled/pull/1090#discussion_r31576616"},"pull_request":{"href":"https://api.github.com/repos/ripple/rippled/pulls/1090"}}},"pull_request":{"url":"https://api.github.com/repos/ripple/rippled/pulls/1090","id":36742216,"html_url":"https://github.com/ripple/rippled/pull/1090","diff_url":"https://github.com/ripple/rippled/pull/1090.diff","patch_url":"https://github.com/ripple/rippled/pull/1090.patch","issue_url":"https://api.github.com/repos/ripple/rippled/issues/1090","number":1090,"state":"open","locked":false,"title":"New Env transaction testing framework:","user":{"login":"vinniefalco","id":1503976,"avatar_url":"https://avatars.githubusercontent.com/u/1503976?v=3","gravatar_id":"","url":"https://api.github.com/users/vinniefalco","html_url":"https://github.com/vinniefalco","followers_url":"https://api.github.com/users/vinniefalco/followers","following_url":"https://api.github.com/users/vinniefalco/following{/other_user}","gists_url":"https://api.github.com/users/vinniefalco/gists{/gist_id}","starred_url":"https://api.github.com/users/vinniefalco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vinniefalco/subscriptions","organizations_url":"https://api.github.com/users/vinniefalco/orgs","repos_url":"https://api.github.com/users/vinniefalco/repos","events_url":"https://api.github.com/users/vinniefalco/events{/privacy}","received_events_url":"https://api.github.com/users/vinniefalco/received_events","type":"User","site_admin":false},"body":"This adds a suite of tools used to write unit tests. The Env provides a context containing a ledger, and routines that assemble transactions from JSON with optional \"funclets\" that add details in an exensible, terse notation.","created_at":"2015-06-02T15:35:44Z","updated_at":"2015-06-02T22:08:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"afee7ca76f7204a0fec74d75f4b05893b099d4cd","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ripple/rippled/pulls/1090/commits","review_comments_url":"https://api.github.com/repos/ripple/rippled/pulls/1090/comments","review_comment_url":"https://api.github.com/repos/ripple/rippled/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ripple/rippled/issues/1090/comments","statuses_url":"https://api.github.com/repos/ripple/rippled/statuses/afdd80a45c35a1b8b94de4cd595d1bfdfe8d3f75","head":{"label":"vinniefalco:tests","ref":"tests","sha":"afdd80a45c35a1b8b94de4cd595d1bfdfe8d3f75","user":{"login":"vinniefalco","id":1503976,"avatar_url":"https://avatars.githubusercontent.com/u/1503976?v=3","gravatar_id":"","url":"https://api.github.com/users/vinniefalco","html_url":"https://github.com/vinniefalco","followers_url":"https://api.github.com/users/vinniefalco/followers","following_url":"https://api.github.com/users/vinniefalco/following{/other_user}","gists_url":"https://api.github.com/users/vinniefalco/gists{/gist_id}","starred_url":"https://api.github.com/users/vinniefalco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vinniefalco/subscriptions","organizations_url":"https://api.github.com/users/vinniefalco/orgs","repos_url":"https://api.github.com/users/vinniefalco/repos","events_url":"https://api.github.com/users/vinniefalco/events{/privacy}","received_events_url":"https://api.github.com/users/vinniefalco/received_events","type":"User","site_admin":false},"repo":{"id":10961863,"name":"rippled","full_name":"vinniefalco/rippled","owner":{"login":"vinniefalco","id":1503976,"avatar_url":"https://avatars.githubusercontent.com/u/1503976?v=3","gravatar_id":"","url":"https://api.github.com/users/vinniefalco","html_url":"https://github.com/vinniefalco","followers_url":"https://api.github.com/users/vinniefalco/followers","following_url":"https://api.github.com/users/vinniefalco/following{/other_user}","gists_url":"https://api.github.com/users/vinniefalco/gists{/gist_id}","starred_url":"https://api.github.com/users/vinniefalco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vinniefalco/subscriptions","organizations_url":"https://api.github.com/users/vinniefalco/orgs","repos_url":"https://api.github.com/users/vinniefalco/repos","events_url":"https://api.github.com/users/vinniefalco/events{/privacy}","received_events_url":"https://api.github.com/users/vinniefalco/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vinniefalco/rippled","description":"Ripple peer-to-peer network daemon","fork":true,"url":"https://api.github.com/repos/vinniefalco/rippled","forks_url":"https://api.github.com/repos/vinniefalco/rippled/forks","keys_url":"https://api.github.com/repos/vinniefalco/rippled/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vinniefalco/rippled/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vinniefalco/rippled/teams","hooks_url":"https://api.github.com/repos/vinniefalco/rippled/hooks","issue_events_url":"https://api.github.com/repos/vinniefalco/rippled/issues/events{/number}","events_url":"https://api.github.com/repos/vinniefalco/rippled/events","assignees_url":"https://api.github.com/repos/vinniefalco/rippled/assignees{/user}","branches_url":"https://api.github.com/repos/vinniefalco/rippled/branches{/branch}","tags_url":"https://api.github.com/repos/vinniefalco/rippled/tags","blobs_url":"https://api.github.com/repos/vinniefalco/rippled/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vinniefalco/rippled/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vinniefalco/rippled/git/refs{/sha}","trees_url":"https://api.github.com/repos/vinniefalco/rippled/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vinniefalco/rippled/statuses/{sha}","languages_url":"https://api.github.com/repos/vinniefalco/rippled/languages","stargazers_url":"https://api.github.com/repos/vinniefalco/rippled/stargazers","contributors_url":"https://api.github.com/repos/vinniefalco/rippled/contributors","subscribers_url":"https://api.github.com/repos/vinniefalco/rippled/subscribers","subscription_url":"https://api.github.com/repos/vinniefalco/rippled/subscription","commits_url":"https://api.github.com/repos/vinniefalco/rippled/commits{/sha}","git_commits_url":"https://api.github.com/repos/vinniefalco/rippled/git/commits{/sha}","comments_url":"https://api.github.com/repos/vinniefalco/rippled/comments{/number}","issue_comment_url":"https://api.github.com/repos/vinniefalco/rippled/issues/comments{/number}","contents_url":"https://api.github.com/repos/vinniefalco/rippled/contents/{+path}","compare_url":"https://api.github.com/repos/vinniefalco/rippled/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vinniefalco/rippled/merges","archive_url":"https://api.github.com/repos/vinniefalco/rippled/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vinniefalco/rippled/downloads","issues_url":"https://api.github.com/repos/vinniefalco/rippled/issues{/number}","pulls_url":"https://api.github.com/repos/vinniefalco/rippled/pulls{/number}","milestones_url":"https://api.github.com/repos/vinniefalco/rippled/milestones{/number}","notifications_url":"https://api.github.com/repos/vinniefalco/rippled/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vinniefalco/rippled/labels{/name}","releases_url":"https://api.github.com/repos/vinniefalco/rippled/releases{/id}","created_at":"2013-06-26T07:51:04Z","updated_at":"2015-05-07T17:26:52Z","pushed_at":"2015-06-02T21:53:56Z","git_url":"git://github.com/vinniefalco/rippled.git","ssh_url":"git@github.com:vinniefalco/rippled.git","clone_url":"https://github.com/vinniefalco/rippled.git","svn_url":"https://github.com/vinniefalco/rippled","homepage":"https://ripple.com","size":67913,"stargazers_count":3,"watchers_count":3,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":3,"default_branch":"develop"}},"base":{"label":"ripple:develop","ref":"develop","sha":"e9d147f4b8a445e7cbcf810f462cb27616325d9d","user":{"login":"ripple","id":3165523,"avatar_url":"https://avatars.githubusercontent.com/u/3165523?v=3","gravatar_id":"","url":"https://api.github.com/users/ripple","html_url":"https://github.com/ripple","followers_url":"https://api.github.com/users/ripple/followers","following_url":"https://api.github.com/users/ripple/following{/other_user}","gists_url":"https://api.github.com/users/ripple/gists{/gist_id}","starred_url":"https://api.github.com/users/ripple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ripple/subscriptions","organizations_url":"https://api.github.com/users/ripple/orgs","repos_url":"https://api.github.com/users/ripple/repos","events_url":"https://api.github.com/users/ripple/events{/privacy}","received_events_url":"https://api.github.com/users/ripple/received_events","type":"Organization","site_admin":false},"repo":{"id":2724167,"name":"rippled","full_name":"ripple/rippled","owner":{"login":"ripple","id":3165523,"avatar_url":"https://avatars.githubusercontent.com/u/3165523?v=3","gravatar_id":"","url":"https://api.github.com/users/ripple","html_url":"https://github.com/ripple","followers_url":"https://api.github.com/users/ripple/followers","following_url":"https://api.github.com/users/ripple/following{/other_user}","gists_url":"https://api.github.com/users/ripple/gists{/gist_id}","starred_url":"https://api.github.com/users/ripple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ripple/subscriptions","organizations_url":"https://api.github.com/users/ripple/orgs","repos_url":"https://api.github.com/users/ripple/repos","events_url":"https://api.github.com/users/ripple/events{/privacy}","received_events_url":"https://api.github.com/users/ripple/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ripple/rippled","description":"Ripple peer-to-peer network daemon","fork":false,"url":"https://api.github.com/repos/ripple/rippled","forks_url":"https://api.github.com/repos/ripple/rippled/forks","keys_url":"https://api.github.com/repos/ripple/rippled/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ripple/rippled/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ripple/rippled/teams","hooks_url":"https://api.github.com/repos/ripple/rippled/hooks","issue_events_url":"https://api.github.com/repos/ripple/rippled/issues/events{/number}","events_url":"https://api.github.com/repos/ripple/rippled/events","assignees_url":"https://api.github.com/repos/ripple/rippled/assignees{/user}","branches_url":"https://api.github.com/repos/ripple/rippled/branches{/branch}","tags_url":"https://api.github.com/repos/ripple/rippled/tags","blobs_url":"https://api.github.com/repos/ripple/rippled/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ripple/rippled/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ripple/rippled/git/refs{/sha}","trees_url":"https://api.github.com/repos/ripple/rippled/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ripple/rippled/statuses/{sha}","languages_url":"https://api.github.com/repos/ripple/rippled/languages","stargazers_url":"https://api.github.com/repos/ripple/rippled/stargazers","contributors_url":"https://api.github.com/repos/ripple/rippled/contributors","subscribers_url":"https://api.github.com/repos/ripple/rippled/subscribers","subscription_url":"https://api.github.com/repos/ripple/rippled/subscription","commits_url":"https://api.github.com/repos/ripple/rippled/commits{/sha}","git_commits_url":"https://api.github.com/repos/ripple/rippled/git/commits{/sha}","comments_url":"https://api.github.com/repos/ripple/rippled/comments{/number}","issue_comment_url":"https://api.github.com/repos/ripple/rippled/issues/comments{/number}","contents_url":"https://api.github.com/repos/ripple/rippled/contents/{+path}","compare_url":"https://api.github.com/repos/ripple/rippled/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ripple/rippled/merges","archive_url":"https://api.github.com/repos/ripple/rippled/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ripple/rippled/downloads","issues_url":"https://api.github.com/repos/ripple/rippled/issues{/number}","pulls_url":"https://api.github.com/repos/ripple/rippled/pulls{/number}","milestones_url":"https://api.github.com/repos/ripple/rippled/milestones{/number}","notifications_url":"https://api.github.com/repos/ripple/rippled/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ripple/rippled/labels{/name}","releases_url":"https://api.github.com/repos/ripple/rippled/releases{/id}","created_at":"2011-11-07T04:40:15Z","updated_at":"2015-05-31T03:11:05Z","pushed_at":"2015-06-02T19:59:59Z","git_url":"git://github.com/ripple/rippled.git","ssh_url":"git@github.com:ripple/rippled.git","clone_url":"https://github.com/ripple/rippled.git","svn_url":"https://github.com/ripple/rippled","homepage":"https://ripple.com","size":116042,"stargazers_count":950,"watchers_count":950,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":269,"mirror_url":null,"open_issues_count":136,"forks":269,"open_issues":136,"watchers":950,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/ripple/rippled/pulls/1090"},"html":{"href":"https://github.com/ripple/rippled/pull/1090"},"issue":{"href":"https://api.github.com/repos/ripple/rippled/issues/1090"},"comments":{"href":"https://api.github.com/repos/ripple/rippled/issues/1090/comments"},"review_comments":{"href":"https://api.github.com/repos/ripple/rippled/pulls/1090/comments"},"review_comment":{"href":"https://api.github.com/repos/ripple/rippled/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ripple/rippled/pulls/1090/commits"},"statuses":{"href":"https://api.github.com/repos/ripple/rippled/statuses/afdd80a45c35a1b8b94de4cd595d1bfdfe8d3f75"}}}}