mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
wallet: Store and annotate withdrawals in the DB
We weren't storing them so far, which is sub-optimal :-) Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
committed by
Rusty Russell
parent
771ff1f214
commit
04c255f3ae
@@ -343,11 +343,18 @@ static struct command_result *json_withdraw(struct command *cmd,
|
|||||||
{
|
{
|
||||||
struct unreleased_tx *utx;
|
struct unreleased_tx *utx;
|
||||||
struct command_result *res;
|
struct command_result *res;
|
||||||
|
struct bitcoin_txid txid;
|
||||||
|
|
||||||
res = json_prepare_tx(cmd, buffer, params, &utx);
|
res = json_prepare_tx(cmd, buffer, params, &utx);
|
||||||
if (res)
|
if (res)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
|
/* Store the transaction in the DB and annotate it as a withdrawal */
|
||||||
|
bitcoin_txid(utx->tx, &txid);
|
||||||
|
wallet_transaction_add(cmd->ld->wallet, utx->tx, 0, 0);
|
||||||
|
wallet_transaction_annotate(cmd->ld->wallet, &txid,
|
||||||
|
TX_WALLET_WITHDRAWAL, 0);
|
||||||
|
|
||||||
return broadcast_and_wait(cmd, utx);
|
return broadcast_and_wait(cmd, utx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user