{"action":"created","comment":{"url":"https://api.github.com/repos/vibhaa/lnd/pulls/comments/235562656","pull_request_review_id":177434479,"id":235562656,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzNTU2MjY1Ng==","diff_hunk":"@@ -79,9 +78,141 @@ func TestSpiderInsufficentFunds (t *testing.T) {\n \t\t\tfmt.Println(err)\n \t\t\tt.Fatal(\"error has been received in first payment, alice->bob\")\n \t\t}\n+\t\tfmt.Println(\"alice -> carol successful\")\n \t\t// if we reach this point, then all the payments have succeeded.\n }\n \n+// bob<->alice channel has insufficient BTC capacity/bandwidth. In this test we\n+// send the payment from Alice to Carol over the Bob peer. (Alice -> Bob ->\n+// Carol) with the Bob -> Carol link being the bottleneck.\n+// Here, Carol does not send Bob any money, and this payment should eventually\n+// timeout.\n+func TestSpiderInsufficentFunds(t *testing.T) {\n+\tt.Parallel()\n+\n+\tchannels, cleanUp, _, err := createClusterChannels(\n+\t\tbtcutil.SatoshiPerBitcoin*5,\n+\t\tbtcutil.SatoshiPerBitcoin*3)\n+\t\tif err != nil {\n+\t\t\tt.Fatalf(\"unable to create channel: %v\", err)\n+\t\t}\n+\t\tdefer cleanUp()\n+\n+\t\tn := newThreeHopNetwork(t, channels.aliceToBob, channels.bobToAlice,\n+\t\tchannels.bobToCarol, channels.carolToBob, testStartingHeight)\n+\t\tif err := n.start(); err != nil {\n+\t\t\tt.Fatalf(\"unable to start three hop network: %v\", err)\n+\t\t}\n+\t\tdefer n.stop()\n+\n+\t\tamount := lnwire.NewMSatFromSatoshis(4 * btcutil.SatoshiPerBitcoin)\n+\t\thtlcAmt, totalTimelock, hops := generateHops(amount, testStartingHeight,\n+\t\t\t\t\tn.firstBobChannelLink, n.carolChannelLink)\n+\n+\t\t// What we expect to happen:\n+\t\t// * HTLC add request to be sent to from Alice to Bob.\n+\t\t// * Alice<->Bob commitment states to be updated.\n+\t\t// * Bob trying to add HTLC add request in Bob<->Carol channel.\n+\t\t// * Not enough funds for that, so it gets added to overFlowQueue in\n+\t\t// Bob->Carol channel.\n+\t\t// Payment times out.\n+\n+\t\tfirstHop := n.firstBobChannelLink.ShortChanID()\n+\t\t// launch second payment here, which sleeps for a bit, and then pays from\n+\t\t// carol to bob.\n+\t\t_, err = n.makePayment(\n+\t\t\tn.aliceServer, n.carolServer, firstHop, hops, amount, htlcAmt,\n+\t\t\ttotalTimelock,\n+\t\t).Wait(10 * time.Second)\n+\t\t// modifications on existing test. We do not want it to fail here.\n+\t\tif err == nil {\n+\t\t\tfmt.Println(err)\n+\t\t\tt.Fatal(\"no error was received in the payment, alice->bob\")\n+\t\t}\n+\t\tfmt.Println(\"alice -> carol failed succesfully\")","path":"htlcswitch/spider_test.go","position":132,"original_position":71,"commit_id":"b693060466f3edba599656bfb3c3a1b57c144b3f","original_commit_id":"b693060466f3edba599656bfb3c3a1b57c144b3f","user":{"login":"vibhaa","id":6024279,"node_id":"MDQ6VXNlcjYwMjQyNzk=","avatar_url":"https://avatars0.githubusercontent.com/u/6024279?v=4","gravatar_id":"","url":"https://api.github.com/users/vibhaa","html_url":"https://github.com/vibhaa","followers_url":"https://api.github.com/users/vibhaa/followers","following_url":"https://api.github.com/users/vibhaa/following{/other_user}","gists_url":"https://api.github.com/users/vibhaa/gists{/gist_id}","starred_url":"https://api.github.com/users/vibhaa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vibhaa/subscriptions","organizations_url":"https://api.github.com/users/vibhaa/orgs","repos_url":"https://api.github.com/users/vibhaa/repos","events_url":"https://api.github.com/users/vibhaa/events{/privacy}","received_events_url":"https://api.github.com/users/vibhaa/received_events","type":"User","site_admin":false},"body":"minor nit - would be helpful if this output was a little more descriptive as to what test succeeded - like \"alice -> carol times out as expected due to lack of funds from bob -> carol\"","created_at":"2018-11-21T23:07:38Z","updated_at":"2018-11-21T23:10:14Z","html_url":"https://github.com/vibhaa/lnd/pull/2#discussion_r235562656","pull_request_url":"https://api.github.com/repos/vibhaa/lnd/pulls/2","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/vibhaa/lnd/pulls/comments/235562656"},"html":{"href":"https://github.com/vibhaa/lnd/pull/2#discussion_r235562656"},"pull_request":{"href":"https://api.github.com/repos/vibhaa/lnd/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/vibhaa/lnd/pulls/2","id":232097648,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMyMDk3NjQ4","html_url":"https://github.com/vibhaa/lnd/pull/2","diff_url":"https://github.com/vibhaa/lnd/pull/2.diff","patch_url":"https://github.com/vibhaa/lnd/pull/2.patch","issue_url":"https://api.github.com/repos/vibhaa/lnd/issues/2","number":2,"state":"open","locked":false,"title":"copied over stuff from old queue branch w/o changes from lnd master","user":{"login":"parimarjan","id":12826670,"node_id":"MDQ6VXNlcjEyODI2Njcw","avatar_url":"https://avatars1.githubusercontent.com/u/12826670?v=4","gravatar_id":"","url":"https://api.github.com/users/parimarjan","html_url":"https://github.com/parimarjan","followers_url":"https://api.github.com/users/parimarjan/followers","following_url":"https://api.github.com/users/parimarjan/following{/other_user}","gists_url":"https://api.github.com/users/parimarjan/gists{/gist_id}","starred_url":"https://api.github.com/users/parimarjan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/parimarjan/subscriptions","organizations_url":"https://api.github.com/users/parimarjan/orgs","repos_url":"https://api.github.com/users/parimarjan/repos","events_url":"https://api.github.com/users/parimarjan/events{/privacy}","received_events_url":"https://api.github.com/users/parimarjan/received_events","type":"User","site_admin":false},"body":"Queue functionality seems to be working. The use case is highlighted in\r\nspider_tests.go:\r\n\r\nNetwork: Alice <-> Bob <-> Carol. \r\nAlice is sending money to Carol, but it gets queued at Bob -> Carol link due to\r\ninsufficient funds. Meanwhile, Carol sends money to Bob. This causes the queued\r\npackets in Bob -> Carol to be dequeued, and the payment succeeds. \r\n\r\nBut there are a few potential issues:\r\n\r\ni) Currently, I rely on a 200 ms sleep call when dequeuing packets when a\r\npayment is received. This is because we signal after the Carol -> Bob htlc has\r\nbeen received by Bob when processing packets in link.go, but there seem to be a\r\nfew more things happening at the switch (in SendHTLC in switch.go) before the\r\npayment is finalized and we should be allowed to send the Bob -> Carol payment.\r\nBut there doesn't seem to be any clear way to signal from the switch to the\r\noverflowQueue (which is managed by the channelLink) without making fairly\r\ninvasive changes (like changing the ChannelLink interface to allow for signaling to the Queue). Potentially, there is a better place to dequeue from the overFlowQueue in link.go, but this wasn't obvious to me.\r\n\r\nii) This does not handle the case when we decide to drop the packets that were\r\nqueued - so would need to propagate a failure message back. Am working on this\r\npart.\r\n\r\niii) Setting SPIDER_FLAG to false, should get us the exact functionality of lnd,\r\n\tbut need to find a better way to add the priorityQueue instead of FIFO queue\r\n\tto queue.go so we only use the priorityQueue if the spider flag is turned on.\r\n","created_at":"2018-11-19T20:11:57Z","updated_at":"2018-11-21T23:10:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9855f7aaa9f9008e056accc65c8ca1d54ffbf85a","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/vibhaa/lnd/pulls/2/commits","review_comments_url":"https://api.github.com/repos/vibhaa/lnd/pulls/2/comments","review_comment_url":"https://api.github.com/repos/vibhaa/lnd/pulls/comments{/number}","comments_url":"https://api.github.com/repos/vibhaa/lnd/issues/2/comments","statuses_url":"https://api.github.com/repos/vibhaa/lnd/statuses/b693060466f3edba599656bfb3c3a1b57c144b3f","head":{"label":"vibhaa:queue-new","ref":"queue-new","sha":"b693060466f3edba599656bfb3c3a1b57c144b3f","user":{"login":"vibhaa","id":6024279,"node_id":"MDQ6VXNlcjYwMjQyNzk=","avatar_url":"https://avatars0.githubusercontent.com/u/6024279?v=4","gravatar_id":"","url":"https://api.github.com/users/vibhaa","html_url":"https://github.com/vibhaa","followers_url":"https://api.github.com/users/vibhaa/followers","following_url":"https://api.github.com/users/vibhaa/following{/other_user}","gists_url":"https://api.github.com/users/vibhaa/gists{/gist_id}","starred_url":"https://api.github.com/users/vibhaa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vibhaa/subscriptions","organizations_url":"https://api.github.com/users/vibhaa/orgs","repos_url":"https://api.github.com/users/vibhaa/repos","events_url":"https://api.github.com/users/vibhaa/events{/privacy}","received_events_url":"https://api.github.com/users/vibhaa/received_events","type":"User","site_admin":false},"repo":{"id":149507806,"node_id":"MDEwOlJlcG9zaXRvcnkxNDk1MDc4MDY=","name":"lnd","full_name":"vibhaa/lnd","private":false,"owner":{"login":"vibhaa","id":6024279,"node_id":"MDQ6VXNlcjYwMjQyNzk=","avatar_url":"https://avatars0.githubusercontent.com/u/6024279?v=4","gravatar_id":"","url":"https://api.github.com/users/vibhaa","html_url":"https://github.com/vibhaa","followers_url":"https://api.github.com/users/vibhaa/followers","following_url":"https://api.github.com/users/vibhaa/following{/other_user}","gists_url":"https://api.github.com/users/vibhaa/gists{/gist_id}","starred_url":"https://api.github.com/users/vibhaa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vibhaa/subscriptions","organizations_url":"https://api.github.com/users/vibhaa/orgs","repos_url":"https://api.github.com/users/vibhaa/repos","events_url":"https://api.github.com/users/vibhaa/events{/privacy}","received_events_url":"https://api.github.com/users/vibhaa/received_events","type":"User","site_admin":false},"html_url":"https://github.com/vibhaa/lnd","description":"Lightning Network Daemon ⚡️","fork":true,"url":"https://api.github.com/repos/vibhaa/lnd","forks_url":"https://api.github.com/repos/vibhaa/lnd/forks","keys_url":"https://api.github.com/repos/vibhaa/lnd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vibhaa/lnd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vibhaa/lnd/teams","hooks_url":"https://api.github.com/repos/vibhaa/lnd/hooks","issue_events_url":"https://api.github.com/repos/vibhaa/lnd/issues/events{/number}","events_url":"https://api.github.com/repos/vibhaa/lnd/events","assignees_url":"https://api.github.com/repos/vibhaa/lnd/assignees{/user}","branches_url":"https://api.github.com/repos/vibhaa/lnd/branches{/branch}","tags_url":"https://api.github.com/repos/vibhaa/lnd/tags","blobs_url":"https://api.github.com/repos/vibhaa/lnd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vibhaa/lnd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vibhaa/lnd/git/refs{/sha}","trees_url":"https://api.github.com/repos/vibhaa/lnd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vibhaa/lnd/statuses/{sha}","languages_url":"https://api.github.com/repos/vibhaa/lnd/languages","stargazers_url":"https://api.github.com/repos/vibhaa/lnd/stargazers","contributors_url":"https://api.github.com/repos/vibhaa/lnd/contributors","subscribers_url":"https://api.github.com/repos/vibhaa/lnd/subscribers","subscription_url":"https://api.github.com/repos/vibhaa/lnd/subscription","commits_url":"https://api.github.com/repos/vibhaa/lnd/commits{/sha}","git_commits_url":"https://api.github.com/repos/vibhaa/lnd/git/commits{/sha}","comments_url":"https://api.github.com/repos/vibhaa/lnd/comments{/number}","issue_comment_url":"https://api.github.com/repos/vibhaa/lnd/issues/comments{/number}","contents_url":"https://api.github.com/repos/vibhaa/lnd/contents/{+path}","compare_url":"https://api.github.com/repos/vibhaa/lnd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vibhaa/lnd/merges","archive_url":"https://api.github.com/repos/vibhaa/lnd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vibhaa/lnd/downloads","issues_url":"https://api.github.com/repos/vibhaa/lnd/issues{/number}","pulls_url":"https://api.github.com/repos/vibhaa/lnd/pulls{/number}","milestones_url":"https://api.github.com/repos/vibhaa/lnd/milestones{/number}","notifications_url":"https://api.github.com/repos/vibhaa/lnd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vibhaa/lnd/labels{/name}","releases_url":"https://api.github.com/repos/vibhaa/lnd/releases{/id}","deployments_url":"https://api.github.com/repos/vibhaa/lnd/deployments","created_at":"2018-09-19T20:22:17Z","updated_at":"2018-10-10T18:01:16Z","pushed_at":"2018-11-21T18:38:31Z","git_url":"git://github.com/vibhaa/lnd.git","ssh_url":"git@github.com:vibhaa/lnd.git","clone_url":"https://github.com/vibhaa/lnd.git","svn_url":"https://github.com/vibhaa/lnd","homepage":"","size":21407,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"vibhaa:master","ref":"master","sha":"642298a6c5291a7c807ac6aaf68b6e087e1c8156","user":{"login":"vibhaa","id":6024279,"node_id":"MDQ6VXNlcjYwMjQyNzk=","avatar_url":"https://avatars0.githubusercontent.com/u/6024279?v=4","gravatar_id":"","url":"https://api.github.com/users/vibhaa","html_url":"https://github.com/vibhaa","followers_url":"https://api.github.com/users/vibhaa/followers","following_url":"https://api.github.com/users/vibhaa/following{/other_user}","gists_url":"https://api.github.com/users/vibhaa/gists{/gist_id}","starred_url":"https://api.github.com/users/vibhaa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vibhaa/subscriptions","organizations_url":"https://api.github.com/users/vibhaa/orgs","repos_url":"https://api.github.com/users/vibhaa/repos","events_url":"https://api.github.com/users/vibhaa/events{/privacy}","received_events_url":"https://api.github.com/users/vibhaa/received_events","type":"User","site_admin":false},"repo":{"id":149507806,"node_id":"MDEwOlJlcG9zaXRvcnkxNDk1MDc4MDY=","name":"lnd","full_name":"vibhaa/lnd","private":false,"owner":{"login":"vibhaa","id":6024279,"node_id":"MDQ6VXNlcjYwMjQyNzk=","avatar_url":"https://avatars0.githubusercontent.com/u/6024279?v=4","gravatar_id":"","url":"https://api.github.com/users/vibhaa","html_url":"https://github.com/vibhaa","followers_url":"https://api.github.com/users/vibhaa/followers","following_url":"https://api.github.com/users/vibhaa/following{/other_user}","gists_url":"https://api.github.com/users/vibhaa/gists{/gist_id}","starred_url":"https://api.github.com/users/vibhaa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vibhaa/subscriptions","organizations_url":"https://api.github.com/users/vibhaa/orgs","repos_url":"https://api.github.com/users/vibhaa/repos","events_url":"https://api.github.com/users/vibhaa/events{/privacy}","received_events_url":"https://api.github.com/users/vibhaa/received_events","type":"User","site_admin":false},"html_url":"https://github.com/vibhaa/lnd","description":"Lightning Network Daemon ⚡️","fork":true,"url":"https://api.github.com/repos/vibhaa/lnd","forks_url":"https://api.github.com/repos/vibhaa/lnd/forks","keys_url":"https://api.github.com/repos/vibhaa/lnd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vibhaa/lnd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vibhaa/lnd/teams","hooks_url":"https://api.github.com/repos/vibhaa/lnd/hooks","issue_events_url":"https://api.github.com/repos/vibhaa/lnd/issues/events{/number}","events_url":"https://api.github.com/repos/vibhaa/lnd/events","assignees_url":"https://api.github.com/repos/vibhaa/lnd/assignees{/user}","branches_url":"https://api.github.com/repos/vibhaa/lnd/branches{/branch}","tags_url":"https://api.github.com/repos/vibhaa/lnd/tags","blobs_url":"https://api.github.com/repos/vibhaa/lnd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vibhaa/lnd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vibhaa/lnd/git/refs{/sha}","trees_url":"https://api.github.com/repos/vibhaa/lnd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vibhaa/lnd/statuses/{sha}","languages_url":"https://api.github.com/repos/vibhaa/lnd/languages","stargazers_url":"https://api.github.com/repos/vibhaa/lnd/stargazers","contributors_url":"https://api.github.com/repos/vibhaa/lnd/contributors","subscribers_url":"https://api.github.com/repos/vibhaa/lnd/subscribers","subscription_url":"https://api.github.com/repos/vibhaa/lnd/subscription","commits_url":"https://api.github.com/repos/vibhaa/lnd/commits{/sha}","git_commits_url":"https://api.github.com/repos/vibhaa/lnd/git/commits{/sha}","comments_url":"https://api.github.com/repos/vibhaa/lnd/comments{/number}","issue_comment_url":"https://api.github.com/repos/vibhaa/lnd/issues/comments{/number}","contents_url":"https://api.github.com/repos/vibhaa/lnd/contents/{+path}","compare_url":"https://api.github.com/repos/vibhaa/lnd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vibhaa/lnd/merges","archive_url":"https://api.github.com/repos/vibhaa/lnd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vibhaa/lnd/downloads","issues_url":"https://api.github.com/repos/vibhaa/lnd/issues{/number}","pulls_url":"https://api.github.com/repos/vibhaa/lnd/pulls{/number}","milestones_url":"https://api.github.com/repos/vibhaa/lnd/milestones{/number}","notifications_url":"https://api.github.com/repos/vibhaa/lnd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vibhaa/lnd/labels{/name}","releases_url":"https://api.github.com/repos/vibhaa/lnd/releases{/id}","deployments_url":"https://api.github.com/repos/vibhaa/lnd/deployments","created_at":"2018-09-19T20:22:17Z","updated_at":"2018-10-10T18:01:16Z","pushed_at":"2018-11-21T18:38:31Z","git_url":"git://github.com/vibhaa/lnd.git","ssh_url":"git@github.com:vibhaa/lnd.git","clone_url":"https://github.com/vibhaa/lnd.git","svn_url":"https://github.com/vibhaa/lnd","homepage":"","size":21407,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/vibhaa/lnd/pulls/2"},"html":{"href":"https://github.com/vibhaa/lnd/pull/2"},"issue":{"href":"https://api.github.com/repos/vibhaa/lnd/issues/2"},"comments":{"href":"https://api.github.com/repos/vibhaa/lnd/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/vibhaa/lnd/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/vibhaa/lnd/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/vibhaa/lnd/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/vibhaa/lnd/statuses/b693060466f3edba599656bfb3c3a1b57c144b3f"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"vibhaa"}}