{"action":"created","comment":{"url":"https://api.github.com/repos/ripple/rippled/pulls/comments/36790474","id":36790474,"diff_hunk":"@@ -175,70 +166,69 @@ void PathRequest::updateComplete ()\n bool PathRequest::isValid (RippleLineCache::ref crCache)\n {\n     ScopedLockType sl (mLock);\n-    bValid = raSrcAccount && raDstAccount &&\n-            saDstAmount > zero;\n-    auto const& lrLedger = crCache->getLedger ();\n+    if (! raSrcAccount || ! raDstAccount)\n+        return false;\n \n-    if (bValid)\n+    if (! convert_all_ && (saSendMax || saDstAmount <= zero))\n     {\n-        if (! crCache->getLedger()->exists(\n-                keylet::account(*raSrcAccount)))\n-        {\n-            // no source account\n-            bValid = false;\n-            jvStatus = rpcError (rpcSRC_ACT_NOT_FOUND);\n-        }\n+        // if send max specified, dst amt must be -1\n+        jvStatus = rpcError(rpcDST_AMT_MALFORMED);\n+        return false;\n     }\n \n-    if (bValid)\n+    if (! crCache->getLedger()->exists(\n+        keylet::account(*raSrcAccount)))\n     {\n-        auto const sleDest = crCache->getLedger()->read(\n-            keylet::account(*raDstAccount));\n+        // source account does not exist\n+        jvStatus = rpcError (rpcSRC_ACT_NOT_FOUND);\n+        return false;\n+    }\n \n-        Json::Value& jvDestCur =\n-                (jvStatus[jss::destination_currencies] = Json::arrayValue);\n+    auto const& lrLedger = crCache->getLedger();\n+    auto const sleDest = crCache->getLedger()->read(\n+        keylet::account(*raDstAccount));\n \n-        if (!sleDest)\n-        {\n-            // no destination account\n-            jvDestCur.append (Json::Value (\"XRP\"));\n+    Json::Value& jvDestCur =\n+        (jvStatus[jss::destination_currencies] = Json::arrayValue);\n \n-            if (!saDstAmount.native ())\n-            {\n-                // only XRP can be send to a non-existent account\n-                bValid = false;\n-                jvStatus = rpcError (rpcACT_NOT_FOUND);\n-            }\n-            else if (saDstAmount < STAmount (lrLedger->fees().accountReserve (0)))\n-            {\n-                // payment must meet reserve\n-                bValid = false;\n-                jvStatus = rpcError (rpcDST_AMT_MALFORMED);\n-            }\n+    if (! sleDest)\n+    {\n+        // no destination account\n+        jvDestCur.append (Json::Value (\"XRP\"));\n+        if (! saDstAmount.native ())\n+        {\n+            // only XRP can be send to a non-existent account","path":"src/ripple/app/paths/PathRequest.cpp","position":104,"original_position":104,"commit_id":"fa4cb52b6145d951651f64184de3fe9ac867e28c","original_commit_id":"fa4cb52b6145d951651f64184de3fe9ac867e28c","user":{"login":"rec","id":253362,"avatar_url":"https://avatars.githubusercontent.com/u/253362?v=3","gravatar_id":"","url":"https://api.github.com/users/rec","html_url":"https://github.com/rec","followers_url":"https://api.github.com/users/rec/followers","following_url":"https://api.github.com/users/rec/following{/other_user}","gists_url":"https://api.github.com/users/rec/gists{/gist_id}","starred_url":"https://api.github.com/users/rec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rec/subscriptions","organizations_url":"https://api.github.com/users/rec/orgs","repos_url":"https://api.github.com/users/rec/repos","events_url":"https://api.github.com/users/rec/events{/privacy}","received_events_url":"https://api.github.com/users/rec/received_events","type":"User","site_admin":false},"body":"Love these sorts of comments.  Can I convince you to make it a full sentence (capitalized in the first and ending in a period)? Many studies show that it's somewhat easier for humans to pick out English text from within code if it's properly punctuated...","created_at":"2015-08-11T19:54:02Z","updated_at":"2015-08-11T19:54:02Z","html_url":"https://github.com/ripple/rippled/pull/1238#discussion_r36790474","pull_request_url":"https://api.github.com/repos/ripple/rippled/pulls/1238","_links":{"self":{"href":"https://api.github.com/repos/ripple/rippled/pulls/comments/36790474"},"html":{"href":"https://github.com/ripple/rippled/pull/1238#discussion_r36790474"},"pull_request":{"href":"https://api.github.com/repos/ripple/rippled/pulls/1238"}}},"pull_request":{"url":"https://api.github.com/repos/ripple/rippled/pulls/1238","id":42158139,"html_url":"https://github.com/ripple/rippled/pull/1238","diff_url":"https://github.com/ripple/rippled/pull/1238.diff","patch_url":"https://github.com/ripple/rippled/pull/1238.patch","issue_url":"https://api.github.com/repos/ripple/rippled/issues/1238","number":1238,"state":"open","locked":false,"title":"Convert all of an asset (RIPD-655)","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":"*Path find request supports a 'send maximum' field, which can be -1.\r\n*Destination amount can be specified as -1, meaning all of an asset.\r\n\r\n\r\n","created_at":"2015-08-11T17:59:12Z","updated_at":"2015-08-11T19:54:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"57f400eae108e39f2c382ee53497fc59935a1ffa","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ripple/rippled/pulls/1238/commits","review_comments_url":"https://api.github.com/repos/ripple/rippled/pulls/1238/comments","review_comment_url":"https://api.github.com/repos/ripple/rippled/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ripple/rippled/issues/1238/comments","statuses_url":"https://api.github.com/repos/ripple/rippled/statuses/fa4cb52b6145d951651f64184de3fe9ac867e28c","head":{"label":"miguelportilla:pf-convert-all","ref":"pf-convert-all","sha":"fa4cb52b6145d951651f64184de3fe9ac867e28c","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-08-11T18:01:56Z","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":59292,"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":"1b85b6eaba3287197d153864e174a665fcd13846","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-08-09T08:23:30Z","pushed_at":"2015-08-11T18:01:56Z","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":120186,"stargazers_count":970,"watchers_count":970,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":274,"mirror_url":null,"open_issues_count":119,"forks":274,"open_issues":119,"watchers":970,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/ripple/rippled/pulls/1238"},"html":{"href":"https://github.com/ripple/rippled/pull/1238"},"issue":{"href":"https://api.github.com/repos/ripple/rippled/issues/1238"},"comments":{"href":"https://api.github.com/repos/ripple/rippled/issues/1238/comments"},"review_comments":{"href":"https://api.github.com/repos/ripple/rippled/pulls/1238/comments"},"review_comment":{"href":"https://api.github.com/repos/ripple/rippled/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ripple/rippled/pulls/1238/commits"},"statuses":{"href":"https://api.github.com/repos/ripple/rippled/statuses/fa4cb52b6145d951651f64184de3fe9ac867e28c"}}}}