mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-02 18:35:00 +01:00
coin moves: record wallet deposits
This commit is contained in:
parent
e623143c9f
commit
fc54bfc488
2 changed files with 24 additions and 0 deletions
|
@ -384,6 +384,18 @@ bool json_tok_streq(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED,
|
||||||
void kill_uncommitted_channel(struct uncommitted_channel *uc UNNEEDED,
|
void kill_uncommitted_channel(struct uncommitted_channel *uc UNNEEDED,
|
||||||
const char *why UNNEEDED)
|
const char *why UNNEEDED)
|
||||||
{ fprintf(stderr, "kill_uncommitted_channel called!\n"); abort(); }
|
{ fprintf(stderr, "kill_uncommitted_channel called!\n"); abort(); }
|
||||||
|
/* Generated stub for new_chain_coin_mvt_sat */
|
||||||
|
struct chain_coin_mvt *new_chain_coin_mvt_sat(const tal_t *ctx UNNEEDED,
|
||||||
|
const char *account_name UNNEEDED,
|
||||||
|
const struct bitcoin_txid *tx_txid UNNEEDED,
|
||||||
|
const struct bitcoin_txid *output_txid UNNEEDED,
|
||||||
|
u32 vout UNNEEDED,
|
||||||
|
struct sha256 *payment_hash UNNEEDED,
|
||||||
|
enum mvt_tag tag UNNEEDED,
|
||||||
|
struct amount_sat amt_sat UNNEEDED,
|
||||||
|
bool is_credit UNNEEDED,
|
||||||
|
enum mvt_unit_type unit UNNEEDED)
|
||||||
|
{ fprintf(stderr, "new_chain_coin_mvt_sat called!\n"); abort(); }
|
||||||
/* Generated stub for new_channel_coin_mvt */
|
/* Generated stub for new_channel_coin_mvt */
|
||||||
struct channel_coin_mvt *new_channel_coin_mvt(const tal_t *ctx UNNEEDED,
|
struct channel_coin_mvt *new_channel_coin_mvt(const tal_t *ctx UNNEEDED,
|
||||||
struct bitcoin_txid *funding_txid UNNEEDED,
|
struct bitcoin_txid *funding_txid UNNEEDED,
|
||||||
|
@ -395,6 +407,9 @@ struct channel_coin_mvt *new_channel_coin_mvt(const tal_t *ctx UNNEEDED,
|
||||||
bool is_credit UNNEEDED,
|
bool is_credit UNNEEDED,
|
||||||
enum mvt_unit_type unit UNNEEDED)
|
enum mvt_unit_type unit UNNEEDED)
|
||||||
{ fprintf(stderr, "new_channel_coin_mvt called!\n"); abort(); }
|
{ fprintf(stderr, "new_channel_coin_mvt called!\n"); abort(); }
|
||||||
|
/* Generated stub for notify_chain_mvt */
|
||||||
|
void notify_chain_mvt(struct lightningd *ld UNNEEDED, const struct chain_coin_mvt *mvt UNNEEDED)
|
||||||
|
{ fprintf(stderr, "notify_chain_mvt called!\n"); abort(); }
|
||||||
/* Generated stub for notify_channel_mvt */
|
/* Generated stub for notify_channel_mvt */
|
||||||
void notify_channel_mvt(struct lightningd *ld UNNEEDED, const struct channel_coin_mvt *mvt UNNEEDED)
|
void notify_channel_mvt(struct lightningd *ld UNNEEDED, const struct channel_coin_mvt *mvt UNNEEDED)
|
||||||
{ fprintf(stderr, "notify_channel_mvt called!\n"); abort(); }
|
{ fprintf(stderr, "notify_channel_mvt called!\n"); abort(); }
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include <common/onionreply.h>
|
#include <common/onionreply.h>
|
||||||
#include <common/wireaddr.h>
|
#include <common/wireaddr.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
#include <lightningd/coin_mvts.h>
|
||||||
#include <lightningd/lightningd.h>
|
#include <lightningd/lightningd.h>
|
||||||
#include <lightningd/notification.h>
|
#include <lightningd/notification.h>
|
||||||
#include <lightningd/peer_control.h>
|
#include <lightningd/peer_control.h>
|
||||||
|
@ -1620,6 +1621,7 @@ int wallet_extract_owned_outputs(struct wallet *w, const struct bitcoin_tx *tx,
|
||||||
bool is_p2sh;
|
bool is_p2sh;
|
||||||
const u8 *script;
|
const u8 *script;
|
||||||
struct amount_asset asset = bitcoin_tx_output_get_amount(tx, output);
|
struct amount_asset asset = bitcoin_tx_output_get_amount(tx, output);
|
||||||
|
struct chain_coin_mvt *mvt;
|
||||||
|
|
||||||
if (!amount_asset_is_main(&asset))
|
if (!amount_asset_is_main(&asset))
|
||||||
continue;
|
continue;
|
||||||
|
@ -1664,6 +1666,13 @@ int wallet_extract_owned_outputs(struct wallet *w, const struct bitcoin_tx *tx,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* add this to our wallet amount */
|
||||||
|
mvt = new_chain_coin_mvt_sat(utxo, "wallet", &utxo->txid,
|
||||||
|
&utxo->txid, utxo->outnum,
|
||||||
|
NULL, DEPOSIT, utxo->amount,
|
||||||
|
true, BTC);
|
||||||
|
notify_chain_mvt(w->ld, mvt);
|
||||||
|
|
||||||
/* This is an unconfirmed change output, we should track it */
|
/* This is an unconfirmed change output, we should track it */
|
||||||
if (!is_p2sh && !blockheight)
|
if (!is_p2sh && !blockheight)
|
||||||
txfilter_add_scriptpubkey(w->ld->owned_txfilter, script);
|
txfilter_add_scriptpubkey(w->ld->owned_txfilter, script);
|
||||||
|
|
Loading…
Add table
Reference in a new issue