{"action":"created","comment":{"url":"https://api.github.com/repos/ripple/rippled/pulls/comments/45270134","id":45270134,"diff_hunk":"@@ -1377,6 +1377,33 @@ class LedgerMasterImp\n         return mCompleteLedgers.toString ();\n     }\n \n+    boost::optional <uint32_t>\n+    getCloseTimeBySeq (LedgerIndex ledgerIndex) override\n+    {\n+        uint256 hash = getHashBySeq (ledgerIndex);\n+        return hash.isNonZero() ? getCloseTimeByHash (hash) : boost::none;\n+    }\n+\n+    boost::optional <uint32_t>\n+    getCloseTimeByHash (LedgerHash const& ledgerHash) override\n+    {\n+        auto node = app_.getNodeStore().fetch (ledgerHash);\n+        if (node &&\n+            (node->getData().size() >= 120))\n+        {\n+            SerialIter it (node->getData().data(), node->getData().size());\n+            if (it.get32() == HashPrefix::ledgerMaster)\n+            {\n+                it.skip (\n+                    4+8+32+    // seq drops parentHash\n+                    32+32+4);  // txHash acctHash parentClose\n+                return it.get32();","path":"src/ripple/app/ledger/impl/LedgerMaster.cpp","position":24,"original_position":24,"commit_id":"c11ae332818365ce1a31ff1cd9e2a21f4346a526","original_commit_id":"c11ae332818365ce1a31ff1cd9e2a21f4346a526","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":"D'oh!! As many times as I read that I missed the prefix. Ok, so how about:\r\n```\r\nconstexpr size_t required = 4 + skip + 4;\r\n```\r\n? :smile: ","created_at":"2015-11-18T22:23:16Z","updated_at":"2015-11-18T22:23:16Z","html_url":"https://github.com/ripple/rippled/pull/1396#discussion_r45270134","pull_request_url":"https://api.github.com/repos/ripple/rippled/pulls/1396","_links":{"self":{"href":"https://api.github.com/repos/ripple/rippled/pulls/comments/45270134"},"html":{"href":"https://github.com/ripple/rippled/pull/1396#discussion_r45270134"},"pull_request":{"href":"https://api.github.com/repos/ripple/rippled/pulls/1396"}}},"pull_request":{"url":"https://api.github.com/repos/ripple/rippled/pulls/1396","id":50451739,"html_url":"https://github.com/ripple/rippled/pull/1396","diff_url":"https://github.com/ripple/rippled/pull/1396.diff","patch_url":"https://github.com/ripple/rippled/pull/1396.patch","issue_url":"https://api.github.com/repos/ripple/rippled/issues/1396","number":1396,"state":"open","locked":false,"title":"Optimizations to the way we handle ledger close times in RPC","user":{"login":"JoelKatz","id":877549,"avatar_url":"https://avatars.githubusercontent.com/u/877549?v=3","gravatar_id":"","url":"https://api.github.com/users/JoelKatz","html_url":"https://github.com/JoelKatz","followers_url":"https://api.github.com/users/JoelKatz/followers","following_url":"https://api.github.com/users/JoelKatz/following{/other_user}","gists_url":"https://api.github.com/users/JoelKatz/gists{/gist_id}","starred_url":"https://api.github.com/users/JoelKatz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JoelKatz/subscriptions","organizations_url":"https://api.github.com/users/JoelKatz/orgs","repos_url":"https://api.github.com/users/JoelKatz/repos","events_url":"https://api.github.com/users/JoelKatz/events{/privacy}","received_events_url":"https://api.github.com/users/JoelKatz/received_events","type":"User","site_admin":false},"body":"1) Add SerialIter::Skip, needed for extracting just the close time\r\n2) Add a \"tx\" option to the \"ledger\" command so you can now do `ledger validated tx` to see all transactions in the validated ledger. (Previously, you had to build the query in JSON to do that.)\r\n3) Add a function to get a ledger's close time without constructing the ledger and crowding the ledger cache. Use this function to date-stamp transactions for RPC.\r\n4) Use the ledger close time function to avoid falsely claiming that the `delivered_amount` is unavailable. We still use only the ledger sequence number in the vast majority of cases.","created_at":"2015-11-11T23:27:14Z","updated_at":"2015-11-18T22:23:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b1670dcb5e7b82e9cadc2b1447958232ca6170df","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ripple/rippled/pulls/1396/commits","review_comments_url":"https://api.github.com/repos/ripple/rippled/pulls/1396/comments","review_comment_url":"https://api.github.com/repos/ripple/rippled/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ripple/rippled/issues/1396/comments","statuses_url":"https://api.github.com/repos/ripple/rippled/statuses/c11ae332818365ce1a31ff1cd9e2a21f4346a526","head":{"label":"ripple:ds_closetime","ref":"ds_closetime","sha":"c11ae332818365ce1a31ff1cd9e2a21f4346a526","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-11-18T13:28:08Z","pushed_at":"2015-11-18T21:17:30Z","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":96231,"stargazers_count":996,"watchers_count":996,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":290,"mirror_url":null,"open_issues_count":127,"forks":290,"open_issues":127,"watchers":996,"default_branch":"develop"}},"base":{"label":"ripple:develop","ref":"develop","sha":"7bb4ff901e8b255214b3a139f557632507c7e2a2","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-11-18T13:28:08Z","pushed_at":"2015-11-18T21:17:30Z","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":96231,"stargazers_count":996,"watchers_count":996,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":290,"mirror_url":null,"open_issues_count":127,"forks":290,"open_issues":127,"watchers":996,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/ripple/rippled/pulls/1396"},"html":{"href":"https://github.com/ripple/rippled/pull/1396"},"issue":{"href":"https://api.github.com/repos/ripple/rippled/issues/1396"},"comments":{"href":"https://api.github.com/repos/ripple/rippled/issues/1396/comments"},"review_comments":{"href":"https://api.github.com/repos/ripple/rippled/pulls/1396/comments"},"review_comment":{"href":"https://api.github.com/repos/ripple/rippled/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ripple/rippled/pulls/1396/commits"},"statuses":{"href":"https://api.github.com/repos/ripple/rippled/statuses/c11ae332818365ce1a31ff1cd9e2a21f4346a526"}}}}