{"action":"created","comment":{"url":"https://api.github.com/repos/ripple/rippled/pulls/comments/29066241","id":29066241,"diff_hunk":"@@ -47,35 +64,58 @@ Status ledgerFromRequest (\n \n     if (!hashValue.empty())\n     {\n+        if (! hashValue.isString ())\n+            return {rpcINVALID_PARAMS, \"ledgerHashNotString\"};\n+\n         uint256 ledgerHash;\n-        if (hashValue.isString() && ledgerHash.SetHex (hashValue.asString ()))\n-            ledger = netOps.getLedgerByHash (ledgerHash);\n-        else\n+        if (! ledgerHash.SetHex (hashValue.asString ()))\n             return {rpcINVALID_PARAMS, \"ledgerHashMalformed\"};\n+           \n+        if ((ledger = netOps.getLedgerByHash (ledgerHash)) == nullptr)\n+        {\n+            auto cl = netOps.getCurrentLedger ();\n+            if (cl == nullptr || ! synced (netOps, cl))\n+                return {rpcNO_NETWORK, \"InsufficientNetworkMode\"};\n+\n+            return {rpcLGR_NOT_FOUND, \"ledgerNotFound\"};\n+        }\n     }\n     else if (indexValue.isNumeric())\n     {\n-        ledger = netOps.getLedgerBySeq (indexValue.asInt());\n+        if ((ledger = netOps.getLedgerBySeq (indexValue.asInt ())) == nullptr)\n+        {\n+            auto cl = netOps.getCurrentLedger ();\n+            if (cl == nullptr || ! synced (netOps, cl))\n+                return {rpcNO_NETWORK, \"InsufficientNetworkMode\"};\n+\n+            return {rpcLGR_NOT_FOUND, \"ledgerNotFound\"};\n+        }\n     }\n     else\n     {\n-        auto index = indexValue.asString();\n-        auto isCurrent = index.empty() || index == \"current\";\n+        auto const index = indexValue.asString ();","path":"src/ripple/rpc/impl/LookupLedger.cpp","position":63,"original_position":63,"commit_id":"b713fe5096e25f738f5b5429e9000533983f7d5e","original_commit_id":"b713fe5096e25f738f5b5429e9000533983f7d5e","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":"@rec You're making a strong argument against both `override` and `final`.","created_at":"2015-04-24T17:07:35Z","updated_at":"2015-04-24T17:07:35Z","html_url":"https://github.com/ripple/rippled/pull/988#discussion_r29066241","pull_request_url":"https://api.github.com/repos/ripple/rippled/pulls/988","_links":{"self":{"href":"https://api.github.com/repos/ripple/rippled/pulls/comments/29066241"},"html":{"href":"https://github.com/ripple/rippled/pull/988#discussion_r29066241"},"pull_request":{"href":"https://api.github.com/repos/ripple/rippled/pulls/988"}}},"pull_request":{"url":"https://api.github.com/repos/ripple/rippled/pulls/988","id":33592484,"html_url":"https://github.com/ripple/rippled/pull/988","diff_url":"https://github.com/ripple/rippled/pull/988.diff","patch_url":"https://github.com/ripple/rippled/pull/988.patch","issue_url":"https://api.github.com/repos/ripple/rippled/issues/988","number":988,"state":"open","locked":false,"title":"Minimize NEEDS_CURRENT_LEDGER requirement (RIPD-840, RIPD-27)","user":{"login":"miguelportilla","id":1524671,"avatar_url":"https://avatars.githubusercontent.com/u/1524671?v=3","gravatar_id":"","url":"https://api.github.com/users/miguelportilla","html_url":"https://github.com/miguelportilla","followers_url":"https://api.github.com/users/miguelportilla/followers","following_url":"https://api.github.com/users/miguelportilla/following{/other_user}","gists_url":"https://api.github.com/users/miguelportilla/gists{/gist_id}","starred_url":"https://api.github.com/users/miguelportilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miguelportilla/subscriptions","organizations_url":"https://api.github.com/users/miguelportilla/orgs","repos_url":"https://api.github.com/users/miguelportilla/repos","events_url":"https://api.github.com/users/miguelportilla/events{/privacy}","received_events_url":"https://api.github.com/users/miguelportilla/received_events","type":"User","site_admin":false},"body":"This enhances the reporting capability of RPC::LookupLedger and reduces the requirement of a current ledger for many RPC commands. The perceived up-time of client handlers improves since requests will not depend on the server being fully synced.","created_at":"2015-04-18T00:19:53Z","updated_at":"2015-04-24T17:07:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d812f3d96982654e4780c5cca363a1a95adf5d14","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ripple/rippled/pulls/988/commits","review_comments_url":"https://api.github.com/repos/ripple/rippled/pulls/988/comments","review_comment_url":"https://api.github.com/repos/ripple/rippled/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ripple/rippled/issues/988/comments","statuses_url":"https://api.github.com/repos/ripple/rippled/statuses/b713fe5096e25f738f5b5429e9000533983f7d5e","head":{"label":"miguelportilla:current_ledger","ref":"current_ledger","sha":"b713fe5096e25f738f5b5429e9000533983f7d5e","user":{"login":"miguelportilla","id":1524671,"avatar_url":"https://avatars.githubusercontent.com/u/1524671?v=3","gravatar_id":"","url":"https://api.github.com/users/miguelportilla","html_url":"https://github.com/miguelportilla","followers_url":"https://api.github.com/users/miguelportilla/followers","following_url":"https://api.github.com/users/miguelportilla/following{/other_user}","gists_url":"https://api.github.com/users/miguelportilla/gists{/gist_id}","starred_url":"https://api.github.com/users/miguelportilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miguelportilla/subscriptions","organizations_url":"https://api.github.com/users/miguelportilla/orgs","repos_url":"https://api.github.com/users/miguelportilla/repos","events_url":"https://api.github.com/users/miguelportilla/events{/privacy}","received_events_url":"https://api.github.com/users/miguelportilla/received_events","type":"User","site_admin":false},"repo":{"id":18802139,"name":"rippled","full_name":"miguelportilla/rippled","owner":{"login":"miguelportilla","id":1524671,"avatar_url":"https://avatars.githubusercontent.com/u/1524671?v=3","gravatar_id":"","url":"https://api.github.com/users/miguelportilla","html_url":"https://github.com/miguelportilla","followers_url":"https://api.github.com/users/miguelportilla/followers","following_url":"https://api.github.com/users/miguelportilla/following{/other_user}","gists_url":"https://api.github.com/users/miguelportilla/gists{/gist_id}","starred_url":"https://api.github.com/users/miguelportilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miguelportilla/subscriptions","organizations_url":"https://api.github.com/users/miguelportilla/orgs","repos_url":"https://api.github.com/users/miguelportilla/repos","events_url":"https://api.github.com/users/miguelportilla/events{/privacy}","received_events_url":"https://api.github.com/users/miguelportilla/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/miguelportilla/rippled","description":"Ripple peer-to-peer network daemon","fork":true,"url":"https://api.github.com/repos/miguelportilla/rippled","forks_url":"https://api.github.com/repos/miguelportilla/rippled/forks","keys_url":"https://api.github.com/repos/miguelportilla/rippled/keys{/key_id}","collaborators_url":"https://api.github.com/repos/miguelportilla/rippled/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/miguelportilla/rippled/teams","hooks_url":"https://api.github.com/repos/miguelportilla/rippled/hooks","issue_events_url":"https://api.github.com/repos/miguelportilla/rippled/issues/events{/number}","events_url":"https://api.github.com/repos/miguelportilla/rippled/events","assignees_url":"https://api.github.com/repos/miguelportilla/rippled/assignees{/user}","branches_url":"https://api.github.com/repos/miguelportilla/rippled/branches{/branch}","tags_url":"https://api.github.com/repos/miguelportilla/rippled/tags","blobs_url":"https://api.github.com/repos/miguelportilla/rippled/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/miguelportilla/rippled/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/miguelportilla/rippled/git/refs{/sha}","trees_url":"https://api.github.com/repos/miguelportilla/rippled/git/trees{/sha}","statuses_url":"https://api.github.com/repos/miguelportilla/rippled/statuses/{sha}","languages_url":"https://api.github.com/repos/miguelportilla/rippled/languages","stargazers_url":"https://api.github.com/repos/miguelportilla/rippled/stargazers","contributors_url":"https://api.github.com/repos/miguelportilla/rippled/contributors","subscribers_url":"https://api.github.com/repos/miguelportilla/rippled/subscribers","subscription_url":"https://api.github.com/repos/miguelportilla/rippled/subscription","commits_url":"https://api.github.com/repos/miguelportilla/rippled/commits{/sha}","git_commits_url":"https://api.github.com/repos/miguelportilla/rippled/git/commits{/sha}","comments_url":"https://api.github.com/repos/miguelportilla/rippled/comments{/number}","issue_comment_url":"https://api.github.com/repos/miguelportilla/rippled/issues/comments{/number}","contents_url":"https://api.github.com/repos/miguelportilla/rippled/contents/{+path}","compare_url":"https://api.github.com/repos/miguelportilla/rippled/compare/{base}...{head}","merges_url":"https://api.github.com/repos/miguelportilla/rippled/merges","archive_url":"https://api.github.com/repos/miguelportilla/rippled/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/miguelportilla/rippled/downloads","issues_url":"https://api.github.com/repos/miguelportilla/rippled/issues{/number}","pulls_url":"https://api.github.com/repos/miguelportilla/rippled/pulls{/number}","milestones_url":"https://api.github.com/repos/miguelportilla/rippled/milestones{/number}","notifications_url":"https://api.github.com/repos/miguelportilla/rippled/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/miguelportilla/rippled/labels{/name}","releases_url":"https://api.github.com/repos/miguelportilla/rippled/releases{/id}","created_at":"2014-04-15T14:02:06Z","updated_at":"2015-02-05T17:31:02Z","pushed_at":"2015-04-23T22:50:29Z","git_url":"git://github.com/miguelportilla/rippled.git","ssh_url":"git@github.com:miguelportilla/rippled.git","clone_url":"https://github.com/miguelportilla/rippled.git","svn_url":"https://github.com/miguelportilla/rippled","homepage":"https://ripple.com","size":54735,"stargazers_count":3,"watchers_count":3,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":3,"default_branch":"develop"}},"base":{"label":"ripple:develop","ref":"develop","sha":"5ce3ed35555e15450adbb3927ef279fcece69f04","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-04-24T01:59:04Z","pushed_at":"2015-04-24T17:07:10Z","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":111730,"stargazers_count":940,"watchers_count":940,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":264,"mirror_url":null,"open_issues_count":135,"forks":264,"open_issues":135,"watchers":940,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/ripple/rippled/pulls/988"},"html":{"href":"https://github.com/ripple/rippled/pull/988"},"issue":{"href":"https://api.github.com/repos/ripple/rippled/issues/988"},"comments":{"href":"https://api.github.com/repos/ripple/rippled/issues/988/comments"},"review_comments":{"href":"https://api.github.com/repos/ripple/rippled/pulls/988/comments"},"review_comment":{"href":"https://api.github.com/repos/ripple/rippled/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ripple/rippled/pulls/988/commits"},"statuses":{"href":"https://api.github.com/repos/ripple/rippled/statuses/b713fe5096e25f738f5b5429e9000533983f7d5e"}}}}