Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stage 1 - Multi-hop payments #14

Closed
magomimmo opened this issue Dec 26, 2017 · 14 comments
Closed

Stage 1 - Multi-hop payments #14

magomimmo opened this issue Dec 26, 2017 · 14 comments

Comments

@magomimmo
Copy link
Contributor

After having opened the channel between Charlie and Bob, mined the funding tx (I generated 3 block instead of just 1), created the invoice as Charlie, when I try to send the payment from Alice to Charlie I get the following error:

{
	"payment_error": "unable to find a path to destination",
	"payment_preimage": "",
	"payment_route": null
}

If I send a payment from Bob to Charlie, by having an open payment channel between them, the send payment works as expected.

@magomimmo
Copy link
Contributor Author

I retried the multi-hop payment from scratch and it's still unable to find a path between Alice and Charlie via Bob. My considerations are the following: In Stage 1 Bob is the only peer without any fund. Could he partecipate in a multi-hop payment without having any fund. Moreover, when Charlie open the channel with Bob, he asked to Bob a commitment of 200.000 satoshi, but he has no funds. How could it partecipate in the multi-hop payment?

@Roasbeef
Copy link
Member

At the point where you attempted the multi-hop payment, if you do lncli describegraph, do you see 3 channel advertised? Due to a recent change, the channels are only fully advertised after 6 blocks.

@magomimmo
Copy link
Contributor Author

Yep. I discovered it this late afternoon by looking at the logs....But there is still something that IMHO is wrong. Bob has no funds in your scenario and the funding tx by Charlie ask for some fund from him.

@magomimmo
Copy link
Contributor Author

magomimmo commented Dec 27, 2017

Hi @Roasbeef with 6 confirmations ii works, but I changed the values for the --push_amt to Alice, in such a way that Bob, the hop between Charlie and Alice, has enough funds in his channel with Alice. I'll try to redo this use case with the same values of the tutorial to see if I'm wrong. In such a case I'll close the issue. Thanks for your time.

@magomimmo
Copy link
Contributor Author

Hi @Roasbeef I confirm that if Bob does not have enough funds in his channel, he can't participate as an hop in the route between Charlie and Alice and this behavior seems to be correct to me. So, this mean that the tutorial has to be updated with correct funds for Bob.

@ndeet
Copy link
Contributor

ndeet commented Dec 29, 2017

@magomimmo @Roasbeef
I tested everything from scratch. The tutorial works as long as we generate 6 blocks after opening the channels.
@magomimmo In my test it does not matter that Bob has no funds initially. I also thought after reading the docs that always both entities need to add funds to the funding tx. But it seems that it is also possible if only one entity adds funds. In the tutorial this is done by Alice and Charlie (Bob never adds any funds to the funding_tx, it seems).

I saw PR #16 is related to this issue but they are not referenced. What I do now.
@magomimmo Can you update your PR and only change the block generation to 6

btcctl --simnet --rpcuser=kek --rpcpass=kek generate 6

The other changes, especially for the amounts are not needed imo.

@magomimmo
Copy link
Contributor Author

@ndeet I'm pretty new to LN, so, I can be deadly wrong.

The following are the original values of the tutorial:

  • Alice opens a channel with Bob. She commits 1M satoshi, Bob 0 (first channel balance - aside from tx fee)
  • Bob adds an invoice of 10K Satoshi on that channel;
  • Alice pays the requested 10K; 990K Alice and 10K Bob is the updated channel's balance (aside from very marginal fee); The channel capacity is still 1M;

Then

  • Charlie open a channel with Bob. Charlie commits for 800K and Bob for 200K.

In my understanding this is only possible if Bob participates in a channel where his current balance is more than 200K, but in scenario of the tutorial he only has 10K in the channel with Alice. Unless LN requires that the limit amount for Bob to participate to a new opened channel is the sum of the capacity of all the channels he participates in.

The other this that's is still obscure to me is Who pays for the funding and the closing txs?

@magomimmo
Copy link
Contributor Author

magomimmo commented Dec 29, 2017

@ndeet I tested everything from scratch too and you're right even on the fact that Bob does not need to have enough funds on-chain to participate in an off-chain payment channel requiring him funds he does not own neither on_chain and neither off_chain. This is very very weird. I try the following: alice close the channel with bob and charlie close the channel with bob. At the end Bob has 210001K on chain, even if he only received a payment of 10k from Alice. there is something that I do not understand.....

@ndeet
Copy link
Contributor

ndeet commented Dec 29, 2017

@magomimmo
Interesting, I think I know what is confusing you:

Note that this time, we supplied the --push_amt argument, which specifies the amount of money we want to other party to have at the first channel state.
It could be interpreted like you said. But I understand it this way: --push_amt is an initial amount which gets pushed to the other channel entity.

The lncli command help shows this:

--push_amt value the number of satoshis to push to the remote side as part of the initial commitment state (default: 0)

So this could be the reason why after closing the channel bob got this 200000 into his wallet. Maybe @Roasbeef can clarify the use case for this option.

@Roasbeef, can you also give some hints why not both entities are required to make a deposit on opening channels. Bob in our case has no penalty if he acts malicious?

@magomimmo
Copy link
Contributor Author

magomimmo commented Dec 29, 2017

@ndeet I dont' know what to say. I'll test what happen when the channel between Charlie and Bob is closed by Bob instead of being closed by Charlie and let you know.

Tested: when Bob close the channel initiated by Charlie with a push amount for him, he gets all of it as well. Weird. The only limitation I see on the push amount value is that it has to be less than the local amount.

BOLT 2 Specification says:

funding_satoshis is the amount the sender is putting into the channel. push_msat is an amount of initial funds that the sender is unconditionally giving to the receiver

The sender is the funder of the channel and the receiver is the fundee. In my understanding at the moment in the specification there is no an open_channel message able to required that both parties participate with their funds for establishing the payment channel. To me it seems that a very useful scenario.is missing.

@magomimmo
Copy link
Contributor Author

@ndeet @Roasbeef I wrote a major review of the Stage 1 Tutorial thta override the current Stage 1 PR. Could please take a look at it before I push the PR. Here il the link: https://github.com/magomimmo/lightning-dev-site/blob/major-stage-1-review/tutorial/01-lncli.md

Thanks so much to be patient

@ndeet
Copy link
Contributor

ndeet commented Dec 30, 2017

Hi @magomimmo
thank you, you really did a lot of rewrite and additional information. As the changes are huge and I have some comments about inconsistencies / improvements I would prefer the following.

  • lets finish this issue by only pushing the changes so that the tutorial works as intended (by changing block generation to 6 after the channel openings
  • open a new issue + new PR with your major changes

This way we can have a working tutorial again without much review needed. And on the other hand your improvements can be checked and discussed in a separate issue + PR.

Currently with the changes sitting only in your branch I can't do inline comments (which is possible when there is a PR). I can see the diff here but can't comment:
master...magomimmo:major-stage-1-review

e.g. minor typo like this

btcct.conf is located under ~/.btcctl directory on POSIX OSes and under ~/Library/Application Support/Btcctl directory on MacOS.

--> btcct.conf should be btcctl.conf

And some other things like what the miner is all about etc should be discussed in a separate issue + PR where we can discuss directly on the code.

@magomimmo
Copy link
Contributor Author

Hi @ndeet I agree. Regarding your comment and fix, just fork my fork. When we're happy with the result we'll submit a separate issue + PR as you said.

Thanks so much for your time and suggestions....

@MaxFangX
Copy link
Contributor

Looks like this is resolved. Thanks for the contributions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants