Skip to content

Commit

Permalink
gossip_control: when searching for a txout, make sure it's not spent!
Browse files Browse the repository at this point in the history
There's no reason for the db to ever return non-NULL if it's spent.  And there's
only one caller, for which that is definitely true.

Suggested-by: @cdecker
Fixes: ElementsProject#1934
Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell authored and cdecker committed Sep 21, 2018
1 parent 24c386c commit 0855422
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 0 additions & 2 deletions tests/test_gossip.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import json
import logging
import os
import pytest
import struct
import subprocess
import time
Expand Down Expand Up @@ -865,7 +864,6 @@ def test_gossipwith(node_factory):
assert num_msgs == 5


@pytest.mark.xfail(strict=True)
def test_gossip_notices_close(node_factory, bitcoind):
# We want IO logging so we can replay a channel_announce to l1.
l1 = node_factory.get_node(options={'log-level': 'io'})
Expand Down
3 changes: 2 additions & 1 deletion wallet/wallet.c
Original file line number Diff line number Diff line change
Expand Up @@ -2139,7 +2139,8 @@ struct outpoint *wallet_outpoint_for_scid(struct wallet *w, tal_t *ctx,
"FROM utxoset "
"WHERE blockheight = ?"
" AND txindex = ?"
" AND outnum = ?");
" AND outnum = ?"
" AND spendheight IS NULL");
sqlite3_bind_int(stmt, 1, short_channel_id_blocknum(scid));
sqlite3_bind_int(stmt, 2, short_channel_id_txnum(scid));
sqlite3_bind_int(stmt, 3, short_channel_id_outnum(scid));
Expand Down

0 comments on commit 0855422

Please sign in to comment.