From 175515b9146ccd4bbbe2a9a9a065370aa879ca71 Mon Sep 17 00:00:00 2001 From: lisa neigut Date: Wed, 1 Apr 2020 21:31:28 -0500 Subject: [PATCH] coin moves: stash the payment hash for onchaind in tracked_output We'll use it when we record 'onchain' htlc movements that are fulfilled --- onchaind/onchaind.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/onchaind/onchaind.c b/onchaind/onchaind.c index 830cd2726..007caa3a1 100644 --- a/onchaind/onchaind.c +++ b/onchaind/onchaind.c @@ -117,6 +117,9 @@ struct tracked_output { struct resolution *resolved; const struct chainparams *chainparams; + + /* stashed so we can pass it along to the coin ledger */ + struct sha256 *payment_hash; }; /* We vary feerate until signature they offered matches. */ @@ -928,6 +931,10 @@ static void handle_htlc_onchain_fulfill(struct tracked_output *out, type_to_string(tmpctx, struct ripemd160, &out->htlc.ripemd)); + /* we stash the payment_hash into the tracking_output so we + * can pass it along, if needbe, to the coin movement tracker */ + out->payment_hash = tal_dup(out, struct sha256, &sha); + /* Tell master we found a preimage. */ status_debug("%s/%s gave us preimage %s", tx_type_name(out->tx_type), @@ -1272,6 +1279,9 @@ static void handle_preimage(const struct chainparams *chainparams, return; } + /* stash the payment_hash so we can track this coin movement */ + outs[i]->payment_hash = tal_dup(outs[i], struct sha256, &sha); + /* Discard any previous resolution. Could be a timeout, * could be due to multiple identical rhashes in tx. */ outs[i]->proposal = tal_free(outs[i]->proposal);