onchaind: Have onchaind annotate unilateral, cheat and mutual closes

onchaind knows best, no need to guess outside.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
Christian Decker 2019-05-28 18:09:30 +02:00 committed by Rusty Russell
parent 61a28ccb39
commit 605358f2a3

View File

@ -1396,6 +1396,7 @@ static void handle_mutual_close(const struct bitcoin_txid *txid,
struct tracked_output **outs)
{
init_reply("Tracking mutual close transaction");
onchain_transaction_annotate(txid, TX_CHANNEL_CLOSE);
/* BOLT #5:
*
@ -1691,6 +1692,7 @@ static void handle_our_unilateral(const struct bitcoin_tx *tx,
size_t i;
init_reply("Tracking our own unilateral close");
onchain_transaction_annotate(txid, TX_CHANNEL_UNILATERAL);
/* BOLT #5:
*
@ -1969,6 +1971,7 @@ static void handle_their_cheat(const struct bitcoin_tx *tx,
size_t i;
init_reply("Tracking their illegal close: taking all funds");
onchain_transaction_annotate(txid, TX_CHANNEL_UNILATERAL | TX_CHANNEL_CHEAT | TX_THEIRS);
/* BOLT #5:
*
@ -2189,6 +2192,7 @@ static void handle_their_unilateral(const struct bitcoin_tx *tx,
size_t i;
init_reply("Tracking their unilateral close");
onchain_transaction_annotate(txid, TX_CHANNEL_UNILATERAL | TX_THEIRS);
/* HSM can't derive this. */
remote_per_commitment_point = this_remote_per_commitment_point;
@ -2403,6 +2407,8 @@ static void handle_unknown_commitment(const struct bitcoin_tx *tx,
int to_us_output = -1;
u8 *local_script;
onchain_transaction_annotate(txid, TX_CHANNEL_UNILATERAL | TX_THEIRS);
resolved_by_other(outs[0], txid, UNKNOWN_UNILATERAL);
if (!possible_remote_per_commitment_point)