Browse Source

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.
travis-debug
Christian Decker 5 years ago
committed by Rusty Russell
parent
commit
453bfbc816
  1. 4
      wallet/wallet.c

4
wallet/wallet.c

@ -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);

Loading…
Cancel
Save