Browse Source

wallet: track our change outputs

Add change scripts to our txfilter so that we mark them as confirmed
(and can subsequently spend them)
pull/2803/head
lisa neigut 6 years ago
committed by Christian Decker
parent
commit
10ed2ebdb4
  1. 1
      tests/test_wallet.py
  2. 5
      wallet/wallet.c

1
tests/test_wallet.py

@ -8,7 +8,6 @@ import pytest
import time import time
@pytest.mark.xfail
def test_withdraw(node_factory, bitcoind): def test_withdraw(node_factory, bitcoind):
amount = 1000000 amount = 1000000
# Don't get any funds from previous runs. # Don't get any funds from previous runs.

5
wallet/wallet.c

@ -1372,6 +1372,11 @@ int wallet_extract_owned_outputs(struct wallet *w, const struct bitcoin_tx *tx,
tal_free(utxo); tal_free(utxo);
continue; 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); outpointfilter_add(w->owned_outpoints, &utxo->txid, utxo->outnum);
if (!amount_sat_add(total, *total, utxo->amount)) if (!amount_sat_add(total, *total, utxo->amount))

Loading…
Cancel
Save