wallet: track our change outputs

Add change scripts to our txfilter so that we mark them as confirmed
(and can subsequently spend them)
This commit is contained in:
lisa neigut 2019-09-03 16:33:10 -05:00 committed by Christian Decker
parent 01e0ba8232
commit 10ed2ebdb4
2 changed files with 5 additions and 1 deletions

View File

@ -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.

View File

@ -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))