From 10ed2ebdb485d6a0f66463b1da9fc425f4bacb45 Mon Sep 17 00:00:00 2001 From: lisa neigut Date: Tue, 3 Sep 2019 16:33:10 -0500 Subject: [PATCH] wallet: track our change outputs Add change scripts to our txfilter so that we mark them as confirmed (and can subsequently spend them) --- tests/test_wallet.py | 1 - wallet/wallet.c | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_wallet.py b/tests/test_wallet.py index f007e052d..d50de4060 100644 --- a/tests/test_wallet.py +++ b/tests/test_wallet.py @@ -8,7 +8,6 @@ import pytest import time -@pytest.mark.xfail def test_withdraw(node_factory, bitcoind): amount = 1000000 # Don't get any funds from previous runs. diff --git a/wallet/wallet.c b/wallet/wallet.c index 9e86688ce..44db30064 100644 --- a/wallet/wallet.c +++ b/wallet/wallet.c @@ -1372,6 +1372,11 @@ int wallet_extract_owned_outputs(struct wallet *w, const struct bitcoin_tx *tx, tal_free(utxo); continue; } + + /* This is an unconfirmed change output, we should track it */ + if (!is_p2sh && !blockheight) + txfilter_add_scriptpubkey(w->ld->owned_txfilter, script); + outpointfilter_add(w->owned_outpoints, &utxo->txid, utxo->outnum); if (!amount_sat_add(total, *total, utxo->amount))