I have three nodes in regtest environment l1, l2, and l3

l1 create a channel with l2

l2 create a channel with l3

l3 create an invoice for l1. l1 can pays it because use the route l1-l2-l3

I presume that here c-lightning use HTLC to accomplish it.

Where can I debug the script? I'd like to see something like this

  # Payment if you have the secret R
# Refund after timeout.

1 Answer 1


In order for you to see these scripts you'll have to force the channel on-chain, along with the HTLC. Only then will the HTLC be swept using the script, otherwise you'll only see the P2WSH output for the HTLC being added and then removed if the payment succeeds or fails.

Under normal operation you wouldn't therefore see the HTLC. When testing c-lightning we do however force this case, to verify that it is being handled correctly. There are two ways to force on-chain settlement:

  • Write a small plugin that simply holds on to the incoming HTLC on either l2 or l3 depending on which channel you want to observe the script.
  • If you compiled with DEVELOPER=1 you can also provide a file with instructions to disconnect if certain messages are seen. This is a bit more involved, but here's a test that shows how that works. It instrucs the l1 to disconnect as soon as it gets a WIRE_REVOKE_AND_ACK message which completes the addition of the HTLC.

Once the HTLC is stuck at some point you can generate a number of blocks until the HTLC timeout approaches, at which point the nodes will publish a unilateral close. Once the channel is closed, and the HTLC timeout expired, the nodes will sweep the HTLC output with the script you're looking for.

  • Thanks for reply. I already installed on my mac, i tried again ./configure --enable-developer and then make DEVELOPER=1, but I get an error: tools/mockup.sh: line 12: syntax error near unexpected token ;;'` I tried even with just make but I get the same error
    – monkeyUser
    Commented Jul 8, 2020 at 14:53
  • That sounds a lot like the bash on Mac isn't really compatible with the script. Can you maybe file an issue and we can see how we can fix it.
    – cdecker
    Commented Jul 9, 2020 at 19:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.