mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
coin moves: pass our currently known channel balance to onchaind
We'll need it to do reconciliation for unexpected/penalty closures and to compute fees paid / outputs trimmed.
This commit is contained in:
parent
15e4e922c9
commit
1f0cfa71b0
@ -571,6 +571,7 @@ enum watch_result onchaind_funding_spent(struct channel *channel,
|
|||||||
&channel->their_shachain.chain,
|
&channel->their_shachain.chain,
|
||||||
chainparams,
|
chainparams,
|
||||||
channel->funding,
|
channel->funding,
|
||||||
|
channel->our_msat,
|
||||||
&channel->channel_info.old_remote_per_commit,
|
&channel->channel_info.old_remote_per_commit,
|
||||||
&channel->channel_info.remote_per_commit,
|
&channel->channel_info.remote_per_commit,
|
||||||
/* BOLT #2:
|
/* BOLT #2:
|
||||||
|
@ -10,6 +10,8 @@ msgdata,onchain_init,shachain,shachain,
|
|||||||
# transaction that we need to parse correctly.
|
# transaction that we need to parse correctly.
|
||||||
msgdata,onchain_init,chainparams,chainparams,
|
msgdata,onchain_init,chainparams,chainparams,
|
||||||
msgdata,onchain_init,funding_amount_satoshi,amount_sat,
|
msgdata,onchain_init,funding_amount_satoshi,amount_sat,
|
||||||
|
# Our current balance (of funding amount, not counting any pending htlcs)
|
||||||
|
msgdata,onchain_init,our_msat,amount_msat,
|
||||||
# Remote per commit point for committed tx.
|
# Remote per commit point for committed tx.
|
||||||
msgdata,onchain_init,old_remote_per_commitment_point,pubkey,
|
msgdata,onchain_init,old_remote_per_commitment_point,pubkey,
|
||||||
# Remote per commit point for current tx (needed if we haven't got revoke_and_ack yet).
|
# Remote per commit point for current tx (needed if we haven't got revoke_and_ack yet).
|
||||||
|
|
@ -75,6 +75,9 @@ static u32 reasonable_depth;
|
|||||||
/* The messages to send at that depth. */
|
/* The messages to send at that depth. */
|
||||||
static u8 **missing_htlc_msgs;
|
static u8 **missing_htlc_msgs;
|
||||||
|
|
||||||
|
/* Our recorded channel balance at 'chain time' */
|
||||||
|
static struct amount_msat our_msat;
|
||||||
|
|
||||||
/* Does option_static_remotekey apply to this commitment tx? */
|
/* Does option_static_remotekey apply to this commitment tx? */
|
||||||
bool option_static_remotekey;
|
bool option_static_remotekey;
|
||||||
|
|
||||||
@ -2817,6 +2820,7 @@ int main(int argc, char *argv[])
|
|||||||
&shachain,
|
&shachain,
|
||||||
&chainparams,
|
&chainparams,
|
||||||
&funding,
|
&funding,
|
||||||
|
&our_msat,
|
||||||
&old_remote_per_commit_point,
|
&old_remote_per_commit_point,
|
||||||
&remote_per_commit_point,
|
&remote_per_commit_point,
|
||||||
&to_self_delay[LOCAL],
|
&to_self_delay[LOCAL],
|
||||||
|
@ -43,7 +43,7 @@ bool fromwire_onchain_dev_memleak(const void *p UNNEEDED)
|
|||||||
bool fromwire_onchain_htlc(const void *p UNNEEDED, struct htlc_stub *htlc UNNEEDED, bool *tell_if_missing UNNEEDED, bool *tell_immediately UNNEEDED)
|
bool fromwire_onchain_htlc(const void *p UNNEEDED, struct htlc_stub *htlc UNNEEDED, bool *tell_if_missing UNNEEDED, bool *tell_immediately UNNEEDED)
|
||||||
{ fprintf(stderr, "fromwire_onchain_htlc called!\n"); abort(); }
|
{ fprintf(stderr, "fromwire_onchain_htlc called!\n"); abort(); }
|
||||||
/* Generated stub for fromwire_onchain_init */
|
/* Generated stub for fromwire_onchain_init */
|
||||||
bool fromwire_onchain_init(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct shachain *shachain UNNEEDED, const struct chainparams **chainparams UNNEEDED, struct amount_sat *funding_amount_satoshi UNNEEDED, struct pubkey *old_remote_per_commitment_point UNNEEDED, struct pubkey *remote_per_commitment_point UNNEEDED, u32 *local_to_self_delay UNNEEDED, u32 *remote_to_self_delay UNNEEDED, u32 *delayed_to_us_feerate UNNEEDED, u32 *htlc_feerate UNNEEDED, u32 *penalty_feerate UNNEEDED, struct amount_sat *local_dust_limit_satoshi UNNEEDED, struct bitcoin_txid *our_broadcast_txid UNNEEDED, u8 **local_scriptpubkey UNNEEDED, u8 **remote_scriptpubkey UNNEEDED, struct pubkey *ourwallet_pubkey UNNEEDED, enum side *opener UNNEEDED, struct basepoints *local_basepoints UNNEEDED, struct basepoints *remote_basepoints UNNEEDED, struct bitcoin_tx **tx UNNEEDED, u32 *tx_blockheight UNNEEDED, u32 *reasonable_depth UNNEEDED, secp256k1_ecdsa_signature **htlc_signature UNNEEDED, u64 *num_htlcs UNNEEDED, u32 *min_possible_feerate UNNEEDED, u32 *max_possible_feerate UNNEEDED, struct pubkey **possible_remote_per_commit_point UNNEEDED, bool *option_static_remotekey UNNEEDED)
|
bool fromwire_onchain_init(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct shachain *shachain UNNEEDED, const struct chainparams **chainparams UNNEEDED, struct amount_sat *funding_amount_satoshi UNNEEDED, struct amount_msat *our_msat UNNEEDED, struct pubkey *old_remote_per_commitment_point UNNEEDED, struct pubkey *remote_per_commitment_point UNNEEDED, u32 *local_to_self_delay UNNEEDED, u32 *remote_to_self_delay UNNEEDED, u32 *delayed_to_us_feerate UNNEEDED, u32 *htlc_feerate UNNEEDED, u32 *penalty_feerate UNNEEDED, struct amount_sat *local_dust_limit_satoshi UNNEEDED, struct bitcoin_txid *our_broadcast_txid UNNEEDED, u8 **local_scriptpubkey UNNEEDED, u8 **remote_scriptpubkey UNNEEDED, struct pubkey *ourwallet_pubkey UNNEEDED, enum side *opener UNNEEDED, struct basepoints *local_basepoints UNNEEDED, struct basepoints *remote_basepoints UNNEEDED, struct bitcoin_tx **tx UNNEEDED, u32 *tx_blockheight UNNEEDED, u32 *reasonable_depth UNNEEDED, secp256k1_ecdsa_signature **htlc_signature UNNEEDED, u64 *num_htlcs UNNEEDED, u32 *min_possible_feerate UNNEEDED, u32 *max_possible_feerate UNNEEDED, struct pubkey **possible_remote_per_commit_point UNNEEDED, bool *option_static_remotekey UNNEEDED)
|
||||||
{ fprintf(stderr, "fromwire_onchain_init called!\n"); abort(); }
|
{ fprintf(stderr, "fromwire_onchain_init called!\n"); abort(); }
|
||||||
/* Generated stub for fromwire_onchain_known_preimage */
|
/* Generated stub for fromwire_onchain_known_preimage */
|
||||||
bool fromwire_onchain_known_preimage(const void *p UNNEEDED, struct preimage *preimage UNNEEDED)
|
bool fromwire_onchain_known_preimage(const void *p UNNEEDED, struct preimage *preimage UNNEEDED)
|
||||||
|
@ -47,7 +47,7 @@ bool fromwire_onchain_dev_memleak(const void *p UNNEEDED)
|
|||||||
bool fromwire_onchain_htlc(const void *p UNNEEDED, struct htlc_stub *htlc UNNEEDED, bool *tell_if_missing UNNEEDED, bool *tell_immediately UNNEEDED)
|
bool fromwire_onchain_htlc(const void *p UNNEEDED, struct htlc_stub *htlc UNNEEDED, bool *tell_if_missing UNNEEDED, bool *tell_immediately UNNEEDED)
|
||||||
{ fprintf(stderr, "fromwire_onchain_htlc called!\n"); abort(); }
|
{ fprintf(stderr, "fromwire_onchain_htlc called!\n"); abort(); }
|
||||||
/* Generated stub for fromwire_onchain_init */
|
/* Generated stub for fromwire_onchain_init */
|
||||||
bool fromwire_onchain_init(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct shachain *shachain UNNEEDED, const struct chainparams **chainparams UNNEEDED, struct amount_sat *funding_amount_satoshi UNNEEDED, struct pubkey *old_remote_per_commitment_point UNNEEDED, struct pubkey *remote_per_commitment_point UNNEEDED, u32 *local_to_self_delay UNNEEDED, u32 *remote_to_self_delay UNNEEDED, u32 *delayed_to_us_feerate UNNEEDED, u32 *htlc_feerate UNNEEDED, u32 *penalty_feerate UNNEEDED, struct amount_sat *local_dust_limit_satoshi UNNEEDED, struct bitcoin_txid *our_broadcast_txid UNNEEDED, u8 **local_scriptpubkey UNNEEDED, u8 **remote_scriptpubkey UNNEEDED, struct pubkey *ourwallet_pubkey UNNEEDED, enum side *opener UNNEEDED, struct basepoints *local_basepoints UNNEEDED, struct basepoints *remote_basepoints UNNEEDED, struct bitcoin_tx **tx UNNEEDED, u32 *tx_blockheight UNNEEDED, u32 *reasonable_depth UNNEEDED, secp256k1_ecdsa_signature **htlc_signature UNNEEDED, u64 *num_htlcs UNNEEDED, u32 *min_possible_feerate UNNEEDED, u32 *max_possible_feerate UNNEEDED, struct pubkey **possible_remote_per_commit_point UNNEEDED, bool *option_static_remotekey UNNEEDED)
|
bool fromwire_onchain_init(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct shachain *shachain UNNEEDED, const struct chainparams **chainparams UNNEEDED, struct amount_sat *funding_amount_satoshi UNNEEDED, struct amount_msat *our_msat UNNEEDED, struct pubkey *old_remote_per_commitment_point UNNEEDED, struct pubkey *remote_per_commitment_point UNNEEDED, u32 *local_to_self_delay UNNEEDED, u32 *remote_to_self_delay UNNEEDED, u32 *delayed_to_us_feerate UNNEEDED, u32 *htlc_feerate UNNEEDED, u32 *penalty_feerate UNNEEDED, struct amount_sat *local_dust_limit_satoshi UNNEEDED, struct bitcoin_txid *our_broadcast_txid UNNEEDED, u8 **local_scriptpubkey UNNEEDED, u8 **remote_scriptpubkey UNNEEDED, struct pubkey *ourwallet_pubkey UNNEEDED, enum side *opener UNNEEDED, struct basepoints *local_basepoints UNNEEDED, struct basepoints *remote_basepoints UNNEEDED, struct bitcoin_tx **tx UNNEEDED, u32 *tx_blockheight UNNEEDED, u32 *reasonable_depth UNNEEDED, secp256k1_ecdsa_signature **htlc_signature UNNEEDED, u64 *num_htlcs UNNEEDED, u32 *min_possible_feerate UNNEEDED, u32 *max_possible_feerate UNNEEDED, struct pubkey **possible_remote_per_commit_point UNNEEDED, bool *option_static_remotekey UNNEEDED)
|
||||||
{ fprintf(stderr, "fromwire_onchain_init called!\n"); abort(); }
|
{ fprintf(stderr, "fromwire_onchain_init called!\n"); abort(); }
|
||||||
/* Generated stub for fromwire_onchain_known_preimage */
|
/* Generated stub for fromwire_onchain_known_preimage */
|
||||||
bool fromwire_onchain_known_preimage(const void *p UNNEEDED, struct preimage *preimage UNNEEDED)
|
bool fromwire_onchain_known_preimage(const void *p UNNEEDED, struct preimage *preimage UNNEEDED)
|
||||||
|
Loading…
Reference in New Issue
Block a user