mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-03 18:57:06 +01:00
wallet: Store transactions we are watching, broadcast or own
This will later allow us to determine the transaction confirmation count, and recover transactions for rebroadcasts. Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
parent
633ffeec6f
commit
50600ae241
1 changed files with 4 additions and 1 deletions
|
@ -85,8 +85,10 @@ static void filter_block_txs(struct chain_topology *topo, struct block *b)
|
||||||
/* We did spends first, in case that tells us to watch tx. */
|
/* We did spends first, in case that tells us to watch tx. */
|
||||||
bitcoin_txid(tx, &txid);
|
bitcoin_txid(tx, &txid);
|
||||||
if (watching_txid(topo, &txid) || we_broadcast(topo, &txid) ||
|
if (watching_txid(topo, &txid) || we_broadcast(topo, &txid) ||
|
||||||
satoshi_owned != 0)
|
satoshi_owned != 0) {
|
||||||
add_tx_to_block(b, tx, i);
|
add_tx_to_block(b, tx, i);
|
||||||
|
wallet_transaction_add(topo->wallet, tx, b->height, i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
b->full_txs = tal_free(b->full_txs);
|
b->full_txs = tal_free(b->full_txs);
|
||||||
}
|
}
|
||||||
|
@ -257,6 +259,7 @@ void broadcast_tx(struct chain_topology *topo,
|
||||||
log_add(topo->log, " (tx %s)",
|
log_add(topo->log, " (tx %s)",
|
||||||
type_to_string(tmpctx, struct bitcoin_txid, &otx->txid));
|
type_to_string(tmpctx, struct bitcoin_txid, &otx->txid));
|
||||||
|
|
||||||
|
wallet_transaction_add(topo->wallet, tx, 0, 0);
|
||||||
bitcoind_sendrawtx(topo->bitcoind, otx->hextx, broadcast_done, otx);
|
bitcoind_sendrawtx(topo->bitcoind, otx->hextx, broadcast_done, otx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue