# Shouldn't happen onchain_bad_command,0x8000 onchain_internal_error,0x8003 onchain_crypto_failed,0x8004 #include # Begin! Here's the onchain tx which spends funding tx, followed by all HTLCs. onchain_init,1 onchain_init,,seed,struct privkey onchain_init,,shachain,struct shachain onchain_init,,funding_amount_satoshi,u64 # Remote per commit point for committed tx. onchain_init,,old_remote_per_commitment_point,struct pubkey # Remote per commit point for current tx (needed if we haven't got revoke_and_ack yet). onchain_init,,remote_per_commitment_point,struct pubkey onchain_init,,local_to_self_delay,u32 onchain_init,,remote_to_self_delay,u32 onchain_init,,feerate_per_kw,u64 onchain_init,,local_dust_limit_satoshi,u64 onchain_init,,remote_revocation_basepoint,struct pubkey # Gives an easy way to tell if it's our unilateral close or theirs... onchain_init,,our_broadcast_txid,struct sha256_double onchain_init,,local_scriptpubkey_len,u16 onchain_init,,local_scriptpubkey,local_scriptpubkey_len*u8 onchain_init,,remote_scriptpubkey_len,u16 onchain_init,,remote_scriptpubkey,remote_scriptpubkey_len*u8 onchain_init,,ourwallet_pubkey,struct pubkey # We need these two for commit number obscurer onchain_init,,funder,enum side onchain_init,,remote_payment_basepoint,struct pubkey onchain_init,,remote_delayed_payment_basepoint,struct pubkey onchain_init,,tx,struct bitcoin_tx onchain_init,,tx_blockheight,u32 onchain_init,,num_htlc_sigs,u16 onchain_init,,htlc_signature,num_htlc_sigs*secp256k1_ecdsa_signature onchain_init,,num_htlcs,u64 #include # This is all the HTLCs: one per message onchain_htlc,2 onchain_htlc,,htlc,struct htlc_stub # This sets what the state is, depending on tx. onchain_init_reply,101 onchain_init_reply,,state,u8 # onchaind->master: Send out a tx. onchain_broadcast_tx,3 onchain_broadcast_tx,,tx,struct bitcoin_tx # master->onchaind: Notifier that an output has been spent by input_num of tx. onchain_spent,4 onchain_spent,,tx,struct bitcoin_tx onchain_spent,,input_num,u32 onchain_spent,,blockheight,u32 # master->onchaind: We will receive more than one of these, as depth changes. onchain_depth,5 onchain_depth,,txid,struct sha256_double onchain_depth,,depth,u32 # onchaind->master: We don't want to watch this tx, or its outputs onchain_unwatch_tx,6 onchain_unwatch_tx,,txid,struct sha256_double onchain_unwatch_tx,,num_outputs,u32 # master->onchaind: We know HTLC preimage onchain_known_preimage,7 onchain_known_preimage,,preimage,struct preimage # onchaind->master: We discovered HTLC preimage onchain_extracted_preimage,8 onchain_extracted_preimage,,preimage,struct preimage