2020-09-09 12:10:25 +02:00
|
|
|
#include <bitcoin/chainparams.h>
|
|
|
|
#include <bitcoin/psbt.h>
|
|
|
|
#include <common/cryptomsg.h>
|
|
|
|
#include <common/channel_config.h>
|
|
|
|
#include <common/channel_id.h>
|
|
|
|
#include <common/derive_basepoints.h>
|
|
|
|
#include <common/features.h>
|
2021-01-08 02:05:06 +01:00
|
|
|
#include <common/fee_states.h>
|
|
|
|
#include <common/htlc_wire.h>
|
2020-09-09 12:10:25 +02:00
|
|
|
#include <common/penalty_base.h>
|
|
|
|
#include <common/per_peer_state.h>
|
|
|
|
|
2020-11-03 17:50:52 +01:00
|
|
|
msgtype,dualopend_init,7000
|
2020-09-09 12:10:25 +02:00
|
|
|
# Which network are we configured for?
|
2020-11-03 17:50:52 +01:00
|
|
|
msgdata,dualopend_init,chainparams,chainparams,
|
|
|
|
msgdata,dualopend_init,our_feature_set,feature_set,
|
|
|
|
msgdata,dualopend_init,their_init_features_len,u16,
|
|
|
|
msgdata,dualopend_init,their_init_features,u8,their_init_features_len
|
2020-09-09 12:10:25 +02:00
|
|
|
# Base configuration we'll offer
|
2020-11-03 17:50:52 +01:00
|
|
|
msgdata,dualopend_init,our_config,channel_config,
|
2020-09-09 12:10:25 +02:00
|
|
|
# Minimum/maximum configuration values we'll accept
|
2020-11-03 17:50:52 +01:00
|
|
|
msgdata,dualopend_init,max_to_self_delay,u32,
|
|
|
|
msgdata,dualopend_init,min_effective_htlc_capacity_msat,amount_msat,
|
|
|
|
msgdata,dualopend_init,pps,per_peer_state,
|
|
|
|
msgdata,dualopend_init,our_basepoints,basepoints,
|
|
|
|
msgdata,dualopend_init,our_funding_pubkey,pubkey,
|
2020-09-09 12:10:25 +02:00
|
|
|
# Constraints in case the other end tries to open a channel.
|
2020-11-03 17:50:52 +01:00
|
|
|
msgdata,dualopend_init,minimum_depth,u32,
|
|
|
|
msgdata,dualopend_init,min_feerate,u32,
|
|
|
|
msgdata,dualopend_init,max_feerate,u32,
|
2020-09-09 12:10:25 +02:00
|
|
|
# Optional msg to send.
|
2020-11-03 17:50:52 +01:00
|
|
|
msgdata,dualopend_init,len,u16,
|
|
|
|
msgdata,dualopend_init,msg,u8,len
|
2020-09-09 12:10:25 +02:00
|
|
|
|
2021-01-08 02:05:06 +01:00
|
|
|
# master-dualopend: peer has reconnected
|
|
|
|
msgtype,dualopend_reinit,7001
|
|
|
|
msgdata,dualopend_reinit,chainparams,chainparams,
|
|
|
|
msgdata,dualopend_reinit,our_feature_set,feature_set,
|
|
|
|
msgdata,dualopend_reinit,their_init_features_len,u16,
|
|
|
|
msgdata,dualopend_reinit,their_init_features,u8,their_init_features_len
|
|
|
|
msgdata,dualopend_reinit,our_config,channel_config,
|
|
|
|
msgdata,dualopend_reinit,their_config,channel_config,
|
|
|
|
msgdata,dualopend_reinit,channel_id,channel_id,
|
|
|
|
msgdata,dualopend_reinit,max_to_self_delay,u32,
|
|
|
|
msgdata,dualopend_reinit,min_effective_htlc_capacity_msat,amount_msat,
|
|
|
|
msgdata,dualopend_reinit,pps,per_peer_state,
|
|
|
|
msgdata,dualopend_reinit,our_basepoints,basepoints,
|
|
|
|
msgdata,dualopend_reinit,our_funding_pubkey,pubkey,
|
|
|
|
msgdata,dualopend_reinit,their_funding_pubkey,pubkey,
|
|
|
|
msgdata,dualopend_reinit,minimum_depth,u32,
|
|
|
|
msgdata,dualopend_reinit,min_feerate,u32,
|
|
|
|
msgdata,dualopend_reinit,max_feerate,u32,
|
|
|
|
msgdata,dualopend_reinit,funding_txid,bitcoin_txid,
|
|
|
|
msgdata,dualopend_reinit,funding_txout,u16,
|
|
|
|
msgdata,dualopend_reinit,funding_satoshi,amount_sat,
|
|
|
|
msgdata,dualopend_reinit,our_funding,amount_msat,
|
|
|
|
msgdata,dualopend_reinit,their_basepoints,basepoints,
|
|
|
|
msgdata,dualopend_reinit,remote_per_commit,pubkey,
|
|
|
|
msgdata,dualopend_reinit,funding_psbt,wally_psbt,
|
|
|
|
msgdata,dualopend_reinit,opener,enum side,
|
|
|
|
msgdata,dualopend_reinit,local_funding_locked,bool,
|
|
|
|
msgdata,dualopend_reinit,remote_funding_locked,bool,
|
|
|
|
msgdata,dualopend_reinit,send_shutdown,bool,
|
|
|
|
msgdata,dualopend_reinit,remote_shutdown_received,bool,
|
|
|
|
msgdata,dualopend_reinit,local_shutdown_len,u16,
|
|
|
|
msgdata,dualopend_reinit,local_shutdown_scriptpubkey,u8,local_shutdown_len
|
|
|
|
msgdata,dualopend_reinit,remote_shutdown_len,u16,
|
|
|
|
msgdata,dualopend_reinit,remote_shutdown_scriptpubkey,u8,remote_shutdown_len
|
|
|
|
msgdata,dualopend_reinit,remote_funding_sigs_received,bool,
|
|
|
|
msgdata,dualopend_reinit,fee_states,fee_states,
|
|
|
|
# Optional msg to send.
|
|
|
|
msgdata,dualopend_reinit,len,u16,
|
|
|
|
msgdata,dualopend_reinit,msg,u8,len
|
|
|
|
|
2020-09-09 12:10:25 +02:00
|
|
|
# dualopend->master: they offered channel, should we continue?
|
2020-11-03 17:50:52 +01:00
|
|
|
msgtype,dualopend_got_offer,7005
|
2020-12-17 22:26:08 +01:00
|
|
|
msgdata,dualopend_got_offer,channel_id,channel_id,
|
2020-11-03 17:50:52 +01:00
|
|
|
msgdata,dualopend_got_offer,opener_funding,amount_sat,
|
|
|
|
msgdata,dualopend_got_offer,dust_limit_satoshis,amount_sat,
|
|
|
|
msgdata,dualopend_got_offer,max_htlc_value_in_flight_msat,amount_msat,
|
|
|
|
msgdata,dualopend_got_offer,htlc_minimum_msat,amount_msat,
|
|
|
|
msgdata,dualopend_got_offer,feerate_funding_max,u32,
|
|
|
|
msgdata,dualopend_got_offer,feerate_funding_min,u32,
|
|
|
|
msgdata,dualopend_got_offer,feerate_funding_best,u32,
|
|
|
|
msgdata,dualopend_got_offer,feerate_per_kw,u32,
|
|
|
|
msgdata,dualopend_got_offer,to_self_delay,u16,
|
|
|
|
msgdata,dualopend_got_offer,max_accepted_htlcs,u16,
|
|
|
|
msgdata,dualopend_got_offer,channel_flags,u8,
|
|
|
|
msgdata,dualopend_got_offer,locktime,u32,
|
|
|
|
msgdata,dualopend_got_offer,shutdown_len,u16,
|
|
|
|
msgdata,dualopend_got_offer,shutdown_scriptpubkey,u8,shutdown_len
|
2020-09-09 12:10:25 +02:00
|
|
|
|
|
|
|
# master->dualopend: reply back with our first funding info/contribs
|
2020-11-03 17:50:52 +01:00
|
|
|
msgtype,dualopend_got_offer_reply,7105
|
|
|
|
msgdata,dualopend_got_offer_reply,accepter_funding,amount_sat,
|
|
|
|
msgdata,dualopend_got_offer_reply,feerate_funding,u32,
|
|
|
|
msgdata,dualopend_got_offer_reply,psbt,wally_psbt,
|
|
|
|
msgdata,dualopend_got_offer_reply,shutdown_len,u16,
|
|
|
|
msgdata,dualopend_got_offer_reply,our_shutdown_scriptpubkey,?u8,shutdown_len
|
2020-09-09 12:10:25 +02:00
|
|
|
|
2021-01-12 20:09:11 +01:00
|
|
|
# dualopend->master: they offered a RBF, should we continue?
|
|
|
|
msgtype,dualopend_got_rbf_offer,7500
|
|
|
|
msgdata,dualopend_got_rbf_offer,channel_id,channel_id,
|
|
|
|
msgdata,dualopend_got_rbf_offer,opener_funding,amount_sat,
|
|
|
|
msgdata,dualopend_got_rbf_offer,funding_feerate_per_kw,u32,
|
|
|
|
msgdata,dualopend_got_rbf_offer,locktime,u32,
|
|
|
|
|
|
|
|
# master->dualopend: reply back with our funding info/contribs
|
|
|
|
msgtype,dualopend_got_rbf_offer_reply,7505
|
|
|
|
msgdata,dualopend_got_rbf_offer_reply,accepter_funding,amount_sat,
|
|
|
|
msgdata,dualopend_got_rbf_offer_reply,psbt,wally_psbt,
|
|
|
|
|
2020-09-09 12:10:25 +02:00
|
|
|
# dualopend->master: ready to commit channel open to database and
|
|
|
|
# get some signatures for the funding_tx.
|
2020-11-03 17:50:52 +01:00
|
|
|
msgtype,dualopend_commit_rcvd,7007
|
|
|
|
msgdata,dualopend_commit_rcvd,their_config,channel_config,
|
|
|
|
msgdata,dualopend_commit_rcvd,remote_first_commit,bitcoin_tx,
|
|
|
|
msgdata,dualopend_commit_rcvd,pbase,?penalty_base,
|
|
|
|
msgdata,dualopend_commit_rcvd,first_commit_sig,bitcoin_signature,
|
|
|
|
msgdata,dualopend_commit_rcvd,psbt,wally_psbt,
|
|
|
|
msgdata,dualopend_commit_rcvd,channel_id,channel_id,
|
|
|
|
msgdata,dualopend_commit_rcvd,revocation_basepoint,pubkey,
|
|
|
|
msgdata,dualopend_commit_rcvd,payment_basepoint,pubkey,
|
|
|
|
msgdata,dualopend_commit_rcvd,htlc_basepoint,pubkey,
|
|
|
|
msgdata,dualopend_commit_rcvd,delayed_payment_basepoint,pubkey,
|
|
|
|
msgdata,dualopend_commit_rcvd,their_per_commit_point,pubkey,
|
|
|
|
msgdata,dualopend_commit_rcvd,remote_fundingkey,pubkey,
|
|
|
|
msgdata,dualopend_commit_rcvd,funding_txid,bitcoin_txid,
|
|
|
|
msgdata,dualopend_commit_rcvd,funding_txout,u16,
|
|
|
|
msgdata,dualopend_commit_rcvd,funding_satoshis,amount_sat,
|
|
|
|
msgdata,dualopend_commit_rcvd,our_funding_sats,amount_sat,
|
|
|
|
msgdata,dualopend_commit_rcvd,channel_flags,u8,
|
|
|
|
msgdata,dualopend_commit_rcvd,feerate_per_kw,u32,
|
|
|
|
msgdata,dualopend_commit_rcvd,our_channel_reserve_satoshis,amount_sat,
|
|
|
|
msgdata,dualopend_commit_rcvd,local_shutdown_len,u16,
|
|
|
|
msgdata,dualopend_commit_rcvd,local_shutdown_scriptpubkey,u8,local_shutdown_len
|
|
|
|
msgdata,dualopend_commit_rcvd,remote_shutdown_len,u16,
|
|
|
|
msgdata,dualopend_commit_rcvd,remote_shutdown_scriptpubkey,u8,remote_shutdown_len
|
2020-09-09 12:10:25 +02:00
|
|
|
|
|
|
|
# dualopend->master: peer updated the psbt
|
2020-11-03 17:50:52 +01:00
|
|
|
msgtype,dualopend_psbt_changed,7107
|
|
|
|
msgdata,dualopend_psbt_changed,channel_id,channel_id,
|
|
|
|
msgdata,dualopend_psbt_changed,funding_serial,u64,
|
|
|
|
msgdata,dualopend_psbt_changed,psbt,wally_psbt,
|
2020-09-09 12:10:25 +02:00
|
|
|
|
2020-09-17 21:46:59 +02:00
|
|
|
# master->dualopend: we updated the psbt
|
2020-11-03 17:50:52 +01:00
|
|
|
msgtype,dualopend_psbt_updated,7108
|
|
|
|
msgdata,dualopend_psbt_updated,psbt,wally_psbt,
|
2020-09-17 21:46:59 +02:00
|
|
|
|
2020-09-09 12:10:25 +02:00
|
|
|
# master->dualopend: fail this channel open
|
2020-11-03 17:50:52 +01:00
|
|
|
msgtype,dualopend_fail,7003
|
|
|
|
msgdata,dualopend_fail,reason,wirestring,
|
2020-09-09 12:10:25 +02:00
|
|
|
|
2020-09-03 20:01:45 +02:00
|
|
|
# dualopend->master: we failed to negotiate channel
|
2020-11-03 17:50:52 +01:00
|
|
|
msgtype,dualopend_failed,7004
|
|
|
|
msgdata,dualopend_failed,reason,wirestring,
|
2020-09-09 12:10:25 +02:00
|
|
|
|
2021-01-12 20:07:10 +01:00
|
|
|
# dualopend->master: we failed to negotate RBF
|
|
|
|
msgtype,dualopend_rbf_failed,7015
|
|
|
|
msgdata,dualopend_rbf_failed,reason,wirestring,
|
|
|
|
|
2020-09-03 20:01:45 +02:00
|
|
|
# master->dualopend: hello, I'd like to start a channel open
|
2020-11-03 17:50:52 +01:00
|
|
|
msgtype,dualopend_opener_init,7200
|
|
|
|
msgdata,dualopend_opener_init,psbt,wally_psbt,
|
|
|
|
msgdata,dualopend_opener_init,funding_amount,amount_sat,
|
|
|
|
msgdata,dualopend_opener_init,local_shutdown_len,u16,
|
|
|
|
msgdata,dualopend_opener_init,local_shutdown_scriptpubkey,u8,local_shutdown_len
|
|
|
|
msgdata,dualopend_opener_init,feerate_per_kw,u32,
|
|
|
|
msgdata,dualopend_opener_init,feerate_per_kw_funding,u32,
|
|
|
|
msgdata,dualopend_opener_init,channel_flags,u8,
|
2020-09-03 20:01:45 +02:00
|
|
|
|
2020-11-03 20:43:48 +01:00
|
|
|
# dualopend->master received tx_sigs from peer
|
|
|
|
msgtype,dualopend_funding_sigs,7010
|
|
|
|
msgdata,dualopend_funding_sigs,signed_psbt,wally_psbt,
|
|
|
|
|
|
|
|
# master->dualopend send our tx_sigs to peer
|
|
|
|
msgtype,dualopend_send_tx_sigs,7011
|
|
|
|
msgdata,dualopend_send_tx_sigs,signed_psbt,wally_psbt,
|
|
|
|
|
2020-11-24 22:10:19 +01:00
|
|
|
# dualopend->master tx sigs transmitted to peer
|
|
|
|
msgtype,dualopend_tx_sigs_sent,7012
|
|
|
|
|
2020-12-10 21:25:54 +01:00
|
|
|
# dualopend->peer peer locked channel
|
|
|
|
msgtype,dualopend_peer_locked,7018
|
|
|
|
msgdata,dualopend_peer_locked,remote_per_commit,pubkey,
|
|
|
|
|
2020-11-24 22:10:19 +01:00
|
|
|
# dualopend->master this channel has been locked
|
|
|
|
msgtype,dualopend_channel_locked,7019
|
|
|
|
msgdata,dualopend_channel_locked,pps,per_peer_state,
|
|
|
|
|
|
|
|
# master->dualopend funding reached depth; tell peer
|
|
|
|
msgtype,dualopend_depth_reached,7020
|
|
|
|
msgdata,dualopend_depth_reached,depth,u32,
|
|
|
|
|
2020-12-01 21:55:05 +01:00
|
|
|
# Tell peer to shut down channel.
|
|
|
|
msgtype,dualopend_send_shutdown,7023
|
|
|
|
msgdata,dualopend_send_shutdown,shutdown_scriptpubkey_len,u16,
|
|
|
|
msgdata,dualopend_send_shutdown,shutdown_scriptpubkey,u8,shutdown_scriptpubkey_len
|
|
|
|
|
|
|
|
# Peer told us that channel is shutting down
|
|
|
|
msgtype,dualopend_got_shutdown,7024
|
|
|
|
msgdata,dualopend_got_shutdown,scriptpubkey_len,u16,
|
|
|
|
msgdata,dualopend_got_shutdown,scriptpubkey,u8,scriptpubkey_len
|
|
|
|
|
2020-12-10 21:25:54 +01:00
|
|
|
# Peer presented proof it was from the future.
|
|
|
|
msgtype,dualopend_fail_fallen_behind,1028
|
|
|
|
|
2020-12-01 21:55:05 +01:00
|
|
|
# Shutdown is complete, ready for closing negotiation. + peer_fd & gossip_fd.
|
|
|
|
msgtype,dualopend_shutdown_complete,7025
|
|
|
|
msgdata,dualopend_shutdown_complete,per_peer_state,per_peer_state,
|
|
|
|
|
2020-09-09 12:10:25 +02:00
|
|
|
# master -> dualopend: do you have a memleak?
|
2020-11-03 17:50:52 +01:00
|
|
|
msgtype,dualopend_dev_memleak,7033
|
2020-09-09 12:10:25 +02:00
|
|
|
|
2020-11-03 17:50:52 +01:00
|
|
|
msgtype,dualopend_dev_memleak_reply,7133
|
|
|
|
msgdata,dualopend_dev_memleak_reply,leak,bool,
|