Browse Source

bitcoind: properly handle spent outputs in gettxout

exit status is not enough to detect spent outputs. gettxout will return a
success exit code and 0 bytes.

Signed-off-by: William Casarin <jb55@jb55.com>
ppa-0.6.1
William Casarin 7 years ago
committed by Rusty Russell
parent
commit
3c0d2813a0
  1. 4
      lightningd/bitcoind.c

4
lightningd/bitcoind.c

@ -432,7 +432,9 @@ static void process_gettxout(struct bitcoin_cli *bcli)
struct bitcoin_tx_output out;
bool valid;
if (*bcli->exitstatus != 0) {
/* As of at least v0.15.1.0, bitcoind returns "success" but an empty
string on a spent gettxout */
if (*bcli->exitstatus != 0 || bcli->output_bytes == 0) {
log_debug(bcli->bitcoind->log, "%s: not unspent output?",
bcli_args(bcli));
tal_free(go);

Loading…
Cancel
Save