Week 3 and 4

During these weeks, I started working on the BOLT2 tests. These included:

  • test_bolt2-01-close_channel.py
  • test_bolt2-01-open_channel.py
  • test_bolt2-02-reestablish.py
  • test_bolt2-10-add-htlc.py
  • test_bolt2-20-open_channel_accepter.py
  • test_bolt2-30-channel_type-open-accept-tlvs.py

I tried running the open_channel and close_channel tests. They were failing for a variety of reasons. I added fundchannel, _fundchannel, _done methods in the LDK script which can be used to interact with LDK-Sample to open a fund channel. I also had to tweak LDK-Sample as the open_channel method used in LDK-Sample required both peer pubkey and its address. I created another method which only uses peer pubkey to open a fundchannel.

I also added kill_fundchannel method in the LDK script. After this, the script side was working fine but the tests were still failing. This was happening because the tests were too specific to C-Lightning. For example:

  • minimum_depth was set to 3 in every accept_channel message.
  • The number of Blocks to be mined was set to 3 as well.
  • dust_limit_satoshis was set to 546.
  • htlc_minimum_msat was set to 0.
  • to_self_delay was set to 6.

These were fixed after Vincenzo introduced a stash which stores these fields from messages returned by lightning implementations in this pull request. The above mentioned fields can be retrieved from the stash. I used the stash wherever necessary in the open_channel and close_channel tests to make Lnprototest cross compatible.

Here are the pull requests and issues raised.

After this the open_channel and close_channel passed successfully. These included four tests:

  • test_open_channel_announce_features
  • test_open_channel_from_accepter_side
  • test_open_channel_opener_side
  • test_close_channel_shutdown_msg_normal_case_receiver_side


Now I will work on the remaining BOLT#2 tests.