json-rpc: Fix test_txprepare if running with postgres

Postgres does not guarantee that the insertion order is the returned order,
which leads us to skip outputs that have already been stolen onto the selected
utxos set, but not added to it because it isn't confirmed. This may also
happen with sqlite3 though it's a lot rarer in that case.
This commit is contained in:
Christian Decker 2020-03-17 18:11:14 +01:00 committed by Rusty Russell
parent 9736c7bfd0
commit 453bfbc816

View file

@ -403,8 +403,10 @@ static const struct utxo **wallet_select(const tal_t *ctx, struct wallet *w,
* confirmation height and that it is below the required
* maxheight (current_height - minconf) */
if (maxheight != 0 &&
(!u->blockheight || *u->blockheight > maxheight))
(!u->blockheight || *u->blockheight > maxheight)) {
tal_free(u);
continue;
}
tal_arr_expand(&utxos, u);