Skip to content

Commit

Permalink
events: add some test events for dual-funding
Browse files Browse the repository at this point in the history
First set of tests, a few cases still missing
  • Loading branch information
niftynei committed Jan 24, 2020
1 parent ea21dfe commit 45fbb33
Show file tree
Hide file tree
Showing 7 changed files with 962 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/events/bolt2-05-open_channel2.events
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Variations on open_channel2.
# Variations on open_channel2, opener view

1. block: height=102 tx=020000000001017b8705087f9bddd2777021d2a1dfefc2f1c5afa833b5c4ab00ccc8a556d042830000000000ffffffff0640420f000000000016001483440596268132e6c99d44dae2d151dabd9a2b2320a1070000000000160014ca5cc81df579bd589a428c0d29dceb81513fce8d60e3160000000000160014d1f40e954d7a792284b6fb19a2e0bf777441d83ea025260000000000160014c6e21030d1ed3a7afb19a3c425fab7b258e30764e0673500000000001600141664d29b4048d224341e0a20bf3d680b3293aaea788b7c29010000001600143ae8c2926dae014d88ff69169ef9a6928c18c09b024730440220308b88e0ebb318b6c75454485edcf39bfaa4c7a9acc9a050037e9107842f156402206c2217dea53a2a3e950b9e441e052c820b99cb5a470b4f513d16f6eb61671ef401210279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f8179800000000

Expand Down
106 changes: 106 additions & 0 deletions tests/events/bolt2-06-open_channel2.events
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# Variations on open_channel2, accepter view
# Command line options: none needed

1. block: height=102 tx=020000000001017b8705087f9bddd2777021d2a1dfefc2f1c5afa833b5c4ab00ccc8a556d042830000000000feffffff0580841e0000000000160014fd9658fbd476d318f3b825b152b152aafa49bc9240420f000000000016001483440596268132e6c99d44dae2d151dabd9a2b2338496d2901000000160014d295f76da2319791f36df5759e45b15d5e105221c0c62d000000000016001454d14ae910793e930d8e33d3de0b0cbf05aa533300093d00000000001600141b42e1fc7b1cd93a469fa67ed5eabf36ce354dd6024730440220782128cb0319a8430a687c51411e34cfaa6641da9a8f881d8898128cb5c46897022056e82d011a95fd6bcb6d0d4f10332b0b0d1227b2c4ced59e540eb708a4b24e4701210279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f8179865000000

2. connect: privkey=0000000000000000000000000000000000000000000000000000000000000002
3. expect-send: type=init localfeatures=2000/3000 option_dual_fund/odd
3. expect-send: type=init localfeatures=1000/3000 option_dual_fund/even
# Compulsory is OK
1. recv: type=init globalfeatures= localfeatures=10aa
# Optional is OK
1. recv: type=init globalfeatures= localfeatures=20aa

4. maybe-send: type=gossip_timestamp_filter
chain_hash=06226e46111a0b59caaf126043eb5bbf28c34f3a5e332a1fc7b2b73cf188910f

5. recv: type=open_channel2
chain_hash=06226e46111a0b59caaf126043eb5bbf28c34f3a5e332a1fc7b2b73cf188910f
temporary_channel_id=0000000000000000000000000000000000000000000000000000000000000000
funding_satoshis=999877
push_msat=0
dust_limit_satoshis=546
max_htlc_value_in_flight_msat=4294967295
htlc_minimum_msat=0
feerate_per_kw=253
feerate_per_kw_funding=253
to_self_delay=6
max_accepted_htlcs=483
# funding_privkey=0000000000000000000000000000000000000000000000000000000000000020
funding_pubkey=03d30199d74fb5a22d47b6e054e2f378cedacffcb89904a61d75d0dbd407143e65
# revocation_basepoint_secret=00000000000000000000000000000000000000000000000000000000000000021
revocation_basepoint=021697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5
# payment_basepoint_secret=0000000000000000000000000000000000000000000000000000000000000022
payment_basepoint=031be68a5a028f2601d0e80d468c344ba331d611b96c358b6032e8b4da0547fc11
# delayed_payment_basepoint_secret=0000000000000000000000000000000000000000000000000000000000000023
delayed_payment_basepoint=03605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479
# htlc_basepoint_secret=0000000000000000000000000000000000000000000000000000000000000024
htlc_basepoint=02e0392cfa338aaf2f0b56c563e3e5e67a5d5fefe3388f85d90c899da20f0198f9
# shachain seed=0000000000000000000000000000000000000000000000000000000000000000
# first per_commitment_secret=02a40c85b6f28da08dfdbe0926c53fab2de6d28c10301f8f7c4073d5e42e3148
first_per_commitment_point=02037803a3228ec3a517835480ffac64c0557d9d75e0fe85861ab0be9eb224e6f8
channel_flags=01
opening_tlv=

6. expect-send: type=accept_channel2
temporary_channel_id=0000000000000000000000000000000000000000000000000000000000000000
funding_satoshis=0
dust_limit_satoshis=546
max_htlc_value_in_flight_msat=18446744073709551615
htlc_minimum_msat=0
minimum_depth=3
to_self_delay=6
max_accepted_htlcs=483
# funding_privkey=0000000000000000000000000000000000000000000000000000000000000010
funding_pubkey=03e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a
# revocation_basepoint_secret=0000000000000000000000000000000000000000000000000000000000000011
revocation_basepoint=03defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34
# payment_basepoint_secret=0000000000000000000000000000000000000000000000000000000000000012
payment_basepoint=025601570cb47f238d2b0286db4a990fa0f3ba28d1a319f5e7cf55c2a2444da7cc
# delayed_payment_basepoint_secret=0000000000000000000000000000000000000000000000000000000000000013
delayed_payment_basepoint=022b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c
# htlc_basepoint_secret=0000000000000000000000000000000000000000000000000000000000000014
htlc_basepoint=024ce119c96e2fa357200b559b2f7dd5a5f02d5290aff74b03f3e471b273211c97
# shachain seed=ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
# first per_commitment_secret=7cc854b54e3e0dcdb010d7a3fee464a9687be6e8db3be6854c475621e007a5dc
first_per_commitment_point=0288a618cb6027c3218a37cbe9e882379f17d87d03f6e99d0b60292478d2aded06
accept_tlv=

7. expect-send: type=funding_add_complete
temporary_channel_id=0000000000000000000000000000000000000000000000000000000000000000
num_inputs=0
num_outputs=0

8. recv: type=funding_add_input
temporary_channel_id=0000000000000000000000000000000000000000000000000000000000000000
# prevtx_txid=16835ac8c154b616baac524163f41fb0c4f82c7b972ad35d4d6f18d854f6856b
input_info=[{sats=1000000,prevtx_txid=6b85f654d8186f4d5dd32a977b2cf8c4b01ff4634152acba16b654c1c85a8316,prevtx_vout=1,prevtx_scriptpubkey=001483440596268132e6c99d44dae2d151dabd9a2b23,max_witness_len=109,script=}]

9. recv: type=funding_add_complete
temporary_channel_id=0000000000000000000000000000000000000000000000000000000000000000
num_inputs=1
num_outputs=0

10. recv: type=commitment_signed
channel_id=1d3160756ceeaf5474f389673aafe0484e58260927871ce92f388f72b0409c18
signature=SIG(0000000000000000000000000000000000000000000000000000000000000020:5ed093e89de7d68797173190ac93c50948dcd0d78ab3fc21d538dae6a4ee766d)
htlc_signature=

11. expect-send: type=commitment_signed
channel_id=1d3160756ceeaf5474f389673aafe0484e58260927871ce92f388f72b0409c18
signature=SIG(0000000000000000000000000000000000000000000000000000000000000010:9007b7f6ce1e2386ba500a78430a605e3e75577d5f5385d658dc7bce2a39b28b)
htlc_signature=

12. expect-send: type=funding_signed2
channel_id=1d3160756ceeaf5474f389673aafe0484e58260927871ce92f388f72b0409c18
witness_stack=

13. block: height=103 n=3 tx=020000000001016b85f654d8186f4d5dd32a977b2cf8c4b01ff4634152acba16b654c1c85a83160100000000ffffffff01c5410f0000000000220020c46bf3d1686d6dbb2d9244f8f67b90370c5aa2747045f1aeccb77d8187117382024730440220798d96d5a057b5b7797988a855217f41af05ece3ba8278366e2f69763c72e785022065d5dd7eeddc0766ddf65557c92b9c52c301f23f94d2cf681860d32153e6ae1e012102d6a3c2d0cf7904ab6af54d7c959435a452b24a63194e1c4e7c337d3ebbb3017b00000000

14. expect-send: type=funding_locked
channel_id=1d3160756ceeaf5474f389673aafe0484e58260927871ce92f388f72b0409c18
next_per_commitment_point=032405cbd0f41225d5f203fe4adac8401321a9e05767c5f8af97d51d2e81fbb206

15. recv: type=funding_locked
channel_id=1d3160756ceeaf5474f389673aafe0484e58260927871ce92f388f72b0409c18
next_per_commitment_point=027eed8389cf8eb715d73111b73d94d2c2d04bf96dc43dfd5b0970d80b3617009d
185 changes: 185 additions & 0 deletions tests/events/bolt2-07-open_channel2.events
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
# Variations on dual-funding open_channel2.
# Command line options: -f no-fuzz=true -f policy=exact -f fundsats=0

1. block: height=102 tx=020000000001017b8705087f9bddd2777021d2a1dfefc2f1c5afa833b5c4ab00ccc8a556d042830000000000ffffffff0640420f000000000016001483440596268132e6c99d44dae2d151dabd9a2b2320a1070000000000160014ca5cc81df579bd589a428c0d29dceb81513fce8d60e3160000000000160014d1f40e954d7a792284b6fb19a2e0bf777441d83ea025260000000000160014c6e21030d1ed3a7afb19a3c425fab7b258e30764e0673500000000001600141664d29b4048d224341e0a20bf3d680b3293aaea788b7c29010000001600143ae8c2926dae014d88ff69169ef9a6928c18c09b024730440220308b88e0ebb318b6c75454485edcf39bfaa4c7a9acc9a050037e9107842f156402206c2217dea53a2a3e950b9e441e052c820b99cb5a470b4f513d16f6eb61671ef401210279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f8179800000000

2. connect: privkey=0000000000000000000000000000000000000000000000000000000000000002
3. expect-send: type=init localfeatures=2000/3000 option_dual_fund/odd
3. expect-send: type=init localfeatures=1000/3000 option_dual_fund/even
# Compulsory is OK
1. recv: type=init globalfeatures= localfeatures=10aa
# Optional is OK
1. recv: type=init globalfeatures= localfeatures=20aa

4. maybe-send: type=gossip_timestamp_filter
chain_hash=06226e46111a0b59caaf126043eb5bbf28c34f3a5e332a1fc7b2b73cf188910f

# Fee is taken out of funding amount
1. recv: type=open_channel2
chain_hash=06226e46111a0b59caaf126043eb5bbf28c34f3a5e332a1fc7b2b73cf188910f
temporary_channel_id=0000000000000000000000000000000000000000000000000000000000000000
funding_satoshis=500000
push_msat=0
dust_limit_satoshis=546
max_htlc_value_in_flight_msat=4294967295
htlc_minimum_msat=0
feerate_per_kw=1000
feerate_per_kw_funding=1000
to_self_delay=6
max_accepted_htlcs=483
# funding_privkey=0000000000000000000000000000000000000000000000000000000000000020
funding_pubkey=03d30199d74fb5a22d47b6e054e2f378cedacffcb89904a61d75d0dbd407143e65
# revocation_basepoint_secret=0000000000000000000000000000000000000000000000000000000000000021
revocation_basepoint=021697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5
# payment_basepoint_secret=0000000000000000000000000000000000000000000000000000000000000022
payment_basepoint=031be68a5a028f2601d0e80d468c344ba331d611b96c358b6032e8b4da0547fc11
# delayed_payment_basepoint_secret=0000000000000000000000000000000000000000000000000000000000000023
delayed_payment_basepoint=03605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479
# htlc_basepoint_secret=0000000000000000000000000000000000000000000000000000000000000024
htlc_basepoint=02e0392cfa338aaf2f0b56c563e3e5e67a5d5fefe3388f85d90c899da20f0198f9
# shachain seed=0000000000000000000000000000000000000000000000000000000000000000
# first per_commitment_secret=02a40c85b6f28da08dfdbe0926c53fab2de6d28c10301f8f7c4073d5e42e3148
first_per_commitment_point=02037803a3228ec3a517835480ffac64c0557d9d75e0fe85861ab0be9eb224e6f8
channel_flags=01
opening_tlv=

# Extra (post fee) is added to funding amount
1. recv: type=open_channel2
chain_hash=06226e46111a0b59caaf126043eb5bbf28c34f3a5e332a1fc7b2b73cf188910f
temporary_channel_id=0000000000000000000000000000000000000000000000000000000000000000
funding_satoshis=400000
push_msat=0
dust_limit_satoshis=546
max_htlc_value_in_flight_msat=4294967295
htlc_minimum_msat=0
feerate_per_kw=1000
feerate_per_kw_funding=1000
to_self_delay=6
max_accepted_htlcs=483
# funding_privkey=0000000000000000000000000000000000000000000000000000000000000020
funding_pubkey=03d30199d74fb5a22d47b6e054e2f378cedacffcb89904a61d75d0dbd407143e65
# revocation_basepoint_secret=0000000000000000000000000000000000000000000000000000000000000021
revocation_basepoint=021697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5
# payment_basepoint_secret=0000000000000000000000000000000000000000000000000000000000000022
payment_basepoint=031be68a5a028f2601d0e80d468c344ba331d611b96c358b6032e8b4da0547fc11
# delayed_payment_basepoint_secret=0000000000000000000000000000000000000000000000000000000000000023
delayed_payment_basepoint=03605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479
# htlc_basepoint_secret=0000000000000000000000000000000000000000000000000000000000000024
htlc_basepoint=02e0392cfa338aaf2f0b56c563e3e5e67a5d5fefe3388f85d90c899da20f0198f9
# shachain seed=0000000000000000000000000000000000000000000000000000000000000000
# first per_commitment_secret=02a40c85b6f28da08dfdbe0926c53fab2de6d28c10301f8f7c4073d5e42e3148
first_per_commitment_point=02037803a3228ec3a517835480ffac64c0557d9d75e0fe85861ab0be9eb224e6f8
channel_flags=01
opening_tlv=

# Exact amount (funding leaves out fee exactly)
1. recv: type=open_channel2
chain_hash=06226e46111a0b59caaf126043eb5bbf28c34f3a5e332a1fc7b2b73cf188910f
temporary_channel_id=0000000000000000000000000000000000000000000000000000000000000000
funding_satoshis=499513
push_msat=0
dust_limit_satoshis=546
max_htlc_value_in_flight_msat=4294967295
htlc_minimum_msat=0
feerate_per_kw=1000
feerate_per_kw_funding=1000
to_self_delay=6
max_accepted_htlcs=483
# funding_privkey=0000000000000000000000000000000000000000000000000000000000000020
funding_pubkey=03d30199d74fb5a22d47b6e054e2f378cedacffcb89904a61d75d0dbd407143e65
# revocation_basepoint_secret=0000000000000000000000000000000000000000000000000000000000000021
revocation_basepoint=021697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5
# payment_basepoint_secret=0000000000000000000000000000000000000000000000000000000000000022
payment_basepoint=031be68a5a028f2601d0e80d468c344ba331d611b96c358b6032e8b4da0547fc11
# delayed_payment_basepoint_secret=0000000000000000000000000000000000000000000000000000000000000023
delayed_payment_basepoint=03605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479
# htlc_basepoint_secret=0000000000000000000000000000000000000000000000000000000000000024
htlc_basepoint=02e0392cfa338aaf2f0b56c563e3e5e67a5d5fefe3388f85d90c899da20f0198f9
# shachain seed=0000000000000000000000000000000000000000000000000000000000000000
# first per_commitment_secret=02a40c85b6f28da08dfdbe0926c53fab2de6d28c10301f8f7c4073d5e42e3148
first_per_commitment_point=02037803a3228ec3a517835480ffac64c0557d9d75e0fe85861ab0be9eb224e6f8
channel_flags=01
opening_tlv=

5. expect-send: type=accept_channel2
temporary_channel_id=0000000000000000000000000000000000000000000000000000000000000000
funding_satoshis=0
dust_limit_satoshis=546
max_htlc_value_in_flight_msat=18446744073709551615
htlc_minimum_msat=0
minimum_depth=3
to_self_delay=6
max_accepted_htlcs=483
# funding_privkey=0000000000000000000000000000000000000000000000000000000000000010
funding_pubkey=03e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a
# revocation_basepoint_secret=0000000000000000000000000000000000000000000000000000000000000011
revocation_basepoint=03defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34
# payment_basepoint_secret=0000000000000000000000000000000000000000000000000000000000000012
payment_basepoint=025601570cb47f238d2b0286db4a990fa0f3ba28d1a319f5e7cf55c2a2444da7cc
# delayed_payment_basepoint_secret=0000000000000000000000000000000000000000000000000000000000000013
delayed_payment_basepoint=022b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c
# htlc_basepoint_secret=0000000000000000000000000000000000000000000000000000000000000014
htlc_basepoint=024ce119c96e2fa357200b559b2f7dd5a5f02d5290aff74b03f3e471b273211c97
# shachain seed=ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
# first per_commitment_secret=7cc854b54e3e0dcdb010d7a3fee464a9687be6e8db3be6854c475621e007a5dc
first_per_commitment_point=0288a618cb6027c3218a37cbe9e882379f17d87d03f6e99d0b60292478d2aded06
accept_tlv=

1. expect-send: type=funding_add_complete
temporary_channel_id=0000000000000000000000000000000000000000000000000000000000000000
num_inputs=0
num_outputs=0

2. recv: type=funding_add_input
temporary_channel_id=0000000000000000000000000000000000000000000000000000000000000000
# prevtx_txid=16835ac8c154b616baac524163f41fb0c4f82c7b972ad35d4d6f18d854f6856b
input_info=[{sats=500000,prevtx_txid=3f05da71fb470a53807eb01db4a9220941e3737fa44bccd1fb00f1968c98396c,prevtx_vout=1,prevtx_scriptpubkey=0014ca5cc81df579bd589a428c0d29dceb81513fce8d,max_witness_len=109,script=}]

3. recv: type=funding_add_complete
temporary_channel_id=0000000000000000000000000000000000000000000000000000000000000000
num_inputs=1
num_outputs=0

4. recv: type=commitment_signed
channel_id=303360524ffb4c7a5c3518c91adbf39324ea0e6126294dd5d52496e634580b37
signature=SIG(0000000000000000000000000000000000000000000000000000000000000020:4529699e6485d9ecfec915eaee64b1d37b71b763c775c0700ac0aefb53dbb98a)
htlc_signature=

5. expect-send: type=commitment_signed
channel_id=303360524ffb4c7a5c3518c91adbf39324ea0e6126294dd5d52496e634580b37
signature=SIG(0000000000000000000000000000000000000000000000000000000000000010:42466ed8bdeec32be708a27c6f130b596060bde84d0cb608facddaa65de37b47)
htlc_signature=

6. expect-send: type=funding_signed2
channel_id=303360524ffb4c7a5c3518c91adbf39324ea0e6126294dd5d52496e634580b37
witness_stack=

# In theory, the accepter should broadcast this transaction for us.
7. block: height=103 n=3 tx=020000000001013f05da71fb470a53807eb01db4a9220941e3737fa44bccd1fb00f1968c98396c0100000000ffffffff01399f070000000000220020c46bf3d1686d6dbb2d9244f8f67b90370c5aa2747045f1aeccb77d81871173820247304402206e0fb45a7abd2cb5c90519d290b444dbdbb4ac319350c3e89cc70bae207c1fe8022020d91b24d102eb883b5acdae8d83b115d7b4b2febed789fd2e94bc567d5e38f501210308d79e1c98df471f4061d9b289a1b6423f727a5b47aabd2b539db4343a51a0e500000000

8. expect-send: type=funding_locked
channel_id=303360524ffb4c7a5c3518c91adbf39324ea0e6126294dd5d52496e634580b37
next_per_commitment_point=032405cbd0f41225d5f203fe4adac8401321a9e05767c5f8af97d51d2e81fbb206

9. recv: type=funding_locked
channel_id=303360524ffb4c7a5c3518c91adbf39324ea0e6126294dd5d52496e634580b37
next_per_commitment_point=027eed8389cf8eb715d73111b73d94d2c2d04bf96dc43dfd5b0970d80b3617009d

# Fails, funding + output above inputs
1. recv: type=funding_add_input
temporary_channel_id=0000000000000000000000000000000000000000000000000000000000000000
# prevtx_txid=16835ac8c154b616baac524163f41fb0c4f82c7b972ad35d4d6f18d854f6856b
input_info=[{sats=500000,prevtx_txid=3f05da71fb470a53807eb01db4a9220941e3737fa44bccd1fb00f1968c98396c,prevtx_vout=1,prevtx_scriptpubkey=0014ca5cc81df579bd589a428c0d29dceb81513fce8d,max_witness_len=109,script=}]

2. recv: type=funding_add_output
temporary_channel_id=0000000000000000000000000000000000000000000000000000000000000000
# prevtx_txid=16835ac8c154b616baac524163f41fb0c4f82c7b972ad35d4d6f18d854f6856b
output_info=[{sats=499800,script=00140f0963bc774334ebc14d11ce940c35cfa6986415}]

3. recv: type=funding_add_complete
temporary_channel_id=0000000000000000000000000000000000000000000000000000000000000000
# prevtx_txid=16835ac8c154b616baac524163f41fb0c4f82c7b972ad35d4d6f18d854f6856b
num_outputs=0
num_inputs=0

4. expect-error:
Loading

0 comments on commit 45fbb33

Please sign in to comment.