Browse Source

coin moves: record new wallet utxos as deposits

These are incoming from onchaind, so the result of any transactions
we've created or outputs we own as a result of a channel closure. These
go into the 'wallet' account.
nifty/pset-pre
lisa neigut 5 years ago
committed by Rusty Russell
parent
commit
6914adf861
  1. 6
      lightningd/onchain_control.c

6
lightningd/onchain_control.c

@ -6,6 +6,7 @@
#include <hsmd/gen_hsm_wire.h> #include <hsmd/gen_hsm_wire.h>
#include <inttypes.h> #include <inttypes.h>
#include <lightningd/chaintopology.h> #include <lightningd/chaintopology.h>
#include <lightningd/coin_mvts.h>
#include <lightningd/hsm_control.h> #include <lightningd/hsm_control.h>
#include <lightningd/log.h> #include <lightningd/log.h>
#include <lightningd/onchain_control.h> #include <lightningd/onchain_control.h>
@ -286,6 +287,7 @@ static void handle_irrevocably_resolved(struct channel *channel, const u8 *msg U
static void onchain_add_utxo(struct channel *channel, const u8 *msg) static void onchain_add_utxo(struct channel *channel, const u8 *msg)
{ {
struct utxo *u = tal(msg, struct utxo); struct utxo *u = tal(msg, struct utxo);
struct chain_coin_mvt *mvt;
u32 blockheight; u32 blockheight;
u->close_info = tal(u, struct unilateral_close_info); u->close_info = tal(u, struct unilateral_close_info);
@ -305,6 +307,10 @@ static void onchain_add_utxo(struct channel *channel, const u8 *msg)
outpointfilter_add(channel->peer->ld->wallet->owned_outpoints, &u->txid, u->outnum); outpointfilter_add(channel->peer->ld->wallet->owned_outpoints, &u->txid, u->outnum);
wallet_add_utxo(channel->peer->ld->wallet, u, p2wpkh); wallet_add_utxo(channel->peer->ld->wallet, u, p2wpkh);
mvt = new_chain_coin_mvt_sat(msg, "wallet", &u->txid, &u->txid, u->outnum,
NULL, DEPOSIT, u->amount, true, BTC);
notify_chain_mvt(channel->peer->ld, mvt);
} }
static void onchain_annotate_txout(struct channel *channel, const u8 *msg) static void onchain_annotate_txout(struct channel *channel, const u8 *msg)

Loading…
Cancel
Save