Skip to content

Commit 36b3883

Browse files
NicolasDorierendothermicdev
authored andcommitted
Fix: getblockfrompeer was always requesting block to the first peer
Changelog-Fixed: getblockfrompeer was always requesting block to the first peer
1 parent dfd9e81 commit 36b3883

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

plugins/bcli.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ static struct command_result *process_getpeerinfo(struct bitcoin_cli *bcli)
644644
start_bitcoin_cli(NULL, bcli->cmd, process_getblockfrompeer, true,
645645
BITCOIND_HIGH_PRIO, stash, "getblockfrompeer",
646646
stash->block_hash,
647-
take(tal_fmt(NULL, "%i", stash->peers[0])), NULL);
647+
take(tal_fmt(NULL, "%i", stash->peers[tal_count(stash->peers) - 1])), NULL);
648648

649649
return command_still_pending(bcli->cmd);
650650
}
@@ -680,7 +680,7 @@ static struct command_result *process_getrawblock(struct bitcoin_cli *bcli)
680680
NULL, bcli->cmd, process_getblockfrompeer,
681681
true, BITCOIND_HIGH_PRIO, stash,
682682
"getblockfrompeer", stash->block_hash,
683-
take(tal_fmt(NULL, "%i", stash->peers[0])),
683+
take(tal_fmt(NULL, "%i", stash->peers[tal_count(stash->peers) - 1])),
684684
NULL);
685685

686686
return command_still_pending(bcli->cmd);

0 commit comments

Comments
 (0)