Browse Source

wallet: Store outputs from onchaind in the DB

Signed-off-by: Christian Decker <decker.christian@gmail.com>
ppa-0.6.1
Christian Decker 7 years ago
parent
commit
37c2873c88
  1. 18
      lightningd/peer_control.c
  2. 3
      wallet/wallet.h

18
lightningd/peer_control.c

@ -1281,7 +1281,23 @@ static void handle_irrevocably_resolved(struct peer *peer, const u8 *msg)
*/
static void onchain_add_utxo(struct peer *peer, const u8 *msg)
{
/* FIXME(cdecker) Implement */
struct utxo *u = tal(msg, struct utxo);
u->close_info = tal(u, struct unilateral_close_info);
u->is_p2sh = true;
u->keyindex = 0;
u->status = output_state_available;
u->close_info->channel_id = peer->channel->id;
u->close_info->peer_id = peer->id;
if (!fromwire_onchain_add_utxo(msg, NULL, &u->txid, &u->outnum,
&u->close_info->commitment_point,
&u->amount)) {
fatal("onchaind gave invalid add_utxo message: %s", tal_hex(msg, msg));
}
wallet_add_utxo(peer->ld->wallet, u, p2wpkh);
}
static unsigned int onchain_msg(struct subd *sd, const u8 *msg, const int *fds)

3
wallet/wallet.h

@ -44,7 +44,8 @@ enum wallet_output_type {
to_local = 1,
htlc_offer = 3,
htlc_recv = 4,
our_change = 5
our_change = 5,
p2wpkh = 6
};
/* A database backed shachain struct. The datastructure is

Loading…
Cancel
Save