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

BOLT7: reply_channel_range parameter #560

Open
wants to merge 4 commits into
base: master
from

Conversation

Projects
None yet
2 participants
@nayuta-ueno
Copy link
Contributor

nayuta-ueno commented Jan 29, 2019

BOLT7 reply_channel_range requirements

The receiver of query_channel_range:

  • For each reply_channel_range:
    • MUST encode a short_channel_id for every open channel it knows in blocks first_blocknum to first_blocknum plus number_of_blocks minus one.

so,

first_blocknum = short_ids[0].block
number_of_blocks = short_ids[LAST].block - first_blocknum + 1

@nayuta-ueno

This comment has been minimized.

Copy link
Contributor Author

nayuta-ueno commented Jan 29, 2019

node implementation different 1

I send below query_channel_range message (testnet).

[query_channel_range]
chain_hash: 43497fd7f826957108f4a30fd9cec3aeba79972084e90ead01ea330900000000
first_blocknum: 0
number_of_blocks: 4294967295
  • c-lightning(commit: c029f2fb0fa53eac8191342ef498ab6d5b8b0b17)
[reply_channel_range]
chain_hash: 43497fd7f826957108f4a30fd9cec3aeba79972084e90ead01ea330900000000
first_blocknum: 0
number_of_blocks: 4294967295
complete: 01
encoded_short_ids: 0178da459d777c15c5d7c6e7a65712c8dd4d2081f4423a1d045444...
  • eclair(eclair-node-0.2-beta8-52821b8.jar)
[reply_channel_range]
chain_hash: 43497fd7f826957108f4a30fd9cec3aeba79972084e90ead01ea330900000000
first_blocknum: 1288195
number_of_blocks: 165984
complete: 01
encoded_short_ids: 0013a803000104000013a808000055000113a8430000fa000013a84c...
  • lnd(commit: 6a78141a2dfde36963b59babdda21ac5ccee6c6f)
[reply_channel_range]
chain_hash: 43497fd7f826957108f4a30fd9cec3aeba79972084e90ead01ea330900000000
first_blocknum: 0
number_of_blocks: 4294967295
complete: 01
encoded_short_ids: 0013a803000104000013a808000055000113a8430000fa000013a84c...
@nayuta-ueno

This comment has been minimized.

Copy link
Contributor Author

nayuta-ueno commented Jan 29, 2019

node implementation different 2

c-lightning and eclair reply reply_channel_range for my query_channel_range whether my init.localfeatures set gossip_queries bit or not.
lnd reply reply_channel_range only when init.localfeatures set gossip_queries bit.

@nayuta-ueno

This comment has been minimized.

Copy link
Contributor Author

nayuta-ueno commented Jan 29, 2019

send:

[query_channel_range]
chain_hash: 43497fd7f826957108f4a30fd9cec3aeba79972084e90ead01ea330900000000
first_blocknum: 0
number_of_blocks: 1

receive from c-lightning/eclair/lnd:

[reply_channel_range]
chain_hash: 43497fd7f826957108f4a30fd9cec3aeba79972084e90ead01ea330900000000
first_blocknum: 0
number_of_blocks: 1
complete: 01
encoded_short_ids: 00

I want to allow below:

[reply_channel_range]
chain_hash: 43497fd7f826957108f4a30fd9cec3aeba79972084e90ead01ea330900000000
first_blocknum: 0
number_of_blocks: 0
complete: 01
encoded_short_ids: (len=0)
@rustyrussell

This comment has been minimized.

Copy link
Collaborator

rustyrussell commented Feb 4, 2019

node implementation different 1

I send below query_channel_range message (testnet).

[query_channel_range]
chain_hash: 43497fd7f826957108f4a30fd9cec3aeba79972084e90ead01ea330900000000
first_blocknum: 0
number_of_blocks: 4294967295
* c-lightning(commit: c029f2fb0fa53eac8191342ef498ab6d5b8b0b17)
[reply_channel_range]
chain_hash: 43497fd7f826957108f4a30fd9cec3aeba79972084e90ead01ea330900000000
first_blocknum: 0
number_of_blocks: 4294967295
complete: 01
encoded_short_ids: 0178da459d777c15c5d7c6e7a65712c8dd4d2081f4423a1d045444...

We revisited this on master recently. If you asked for block 100 and number_of_blocks 4294967295 we got upset and the peer for trying to make us overflow. We now handle it correctly.

* eclair(eclair-node-0.2-beta8-52821b8.jar)
[reply_channel_range]
chain_hash: 43497fd7f826957108f4a30fd9cec3aeba79972084e90ead01ea330900000000
first_blocknum: 1288195
number_of_blocks: 165984
complete: 01
encoded_short_ids: 0013a803000104000013a808000055000113a8430000fa000013a84c...

This answer is incorrect. It should cover the entire range. It may do so by simply sending two empty reply_channel_range: 0 to 1288194 and (1288195+165984) to 4294967295.

@rustyrussell

This comment has been minimized.

Copy link
Collaborator

rustyrussell commented Feb 4, 2019

I want to allow below:

[reply_channel_range]
chain_hash: 43497fd7f826957108f4a30fd9cec3aeba79972084e90ead01ea330900000000
first_blocknum: 0
number_of_blocks: 0
complete: 01
encoded_short_ids: (len=0)

We expect the encoding byte to exist. For us, I think, that's easier to create and interpret. Is there a reason you don't want the extra byte?

@nayuta-ueno

This comment has been minimized.

Copy link
Contributor Author

nayuta-ueno commented Feb 4, 2019

This answer is incorrect. It should cover the entire range. It may do so by simply sending two empty reply_channel_range: 0 to 1288194 and (1288195+165984) to 4294967295.

Oh, I had misunderstanding: complete=1 means "this is last reply_channel_range message".
It is OK.

BOLT7: reply_channel_range
* `first_blocknum` and `number_of_blocks` mean checking range
@nayuta-ueno

This comment has been minimized.

Copy link
Contributor Author

nayuta-ueno commented Feb 4, 2019

Is there a reason you don't want the extra byte?

Simply len==0 means "no channel_ids".
But either one is fine.
I'll change it to contain "encoding types".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment