Browse Source

bitcoind: Do not copy the newline character when asking for a block

In the short_channel_id check we were copying the entire result into the next
bitcoin-cli call, including the newline character.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
Reported-By: @gdassori
ppa-0.6.1
Christian Decker 7 years ago
committed by Rusty Russell
parent
commit
0ba687732f
  1. 8
      lightningd/bitcoind.c

8
lightningd/bitcoind.c

@ -604,6 +604,7 @@ static bool process_getblockhash_for_txout(struct bitcoin_cli *bcli)
const struct bitcoin_tx_output *output, const struct bitcoin_tx_output *output,
void *arg) = bcli->cb; void *arg) = bcli->cb;
struct get_output *go = bcli->cb_arg; struct get_output *go = bcli->cb_arg;
char *blockhash;
if (*bcli->exitstatus != 0) { if (*bcli->exitstatus != 0) {
void *cbarg = go->cbarg; void *cbarg = go->cbarg;
@ -614,10 +615,11 @@ static bool process_getblockhash_for_txout(struct bitcoin_cli *bcli)
return true; return true;
} }
/* Strip the newline at the end of the previous output */
blockhash = tal_strndup(NULL, bcli->output, bcli->output_bytes-1);
start_bitcoin_cli(bcli->bitcoind, NULL, process_getblock, false, cb, go, start_bitcoin_cli(bcli->bitcoind, NULL, process_getblock, false, cb, go,
"getblock", "getblock", take(blockhash), NULL);
take(tal_strndup(NULL, bcli->output,bcli->output_bytes)),
NULL);
return true; return true;
} }

Loading…
Cancel
Save