Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lightningd/bitcoind.c
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ getrawblockbyheight_callback(const char *buf, const jsmntok_t *toks,
}

err = json_scan(tmpctx, buf, resulttok, "{blockhash:%,block:%}",
JSON_SCAN(json_to_sha256, &blkid.shad.sha),
JSON_SCAN(json_to_bitcoin_blkid, &blkid),
JSON_SCAN_TAL(tmpctx, json_strdup, &block_str));
if (err)
bitcoin_plugin_error(call->bitcoind, buf, resulttok,
Expand Down
3 changes: 3 additions & 0 deletions tests/test_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ def test_block_backfill(node_factory, bitcoind, chainparams):
heights = [r['height'] for r in l3.db_query("SELECT height FROM blocks")]
assert(103 in heights)

stored_hash = only_one(l3.db_query("SELECT hash FROM blocks WHERE height = 103"))['hash']
assert bytes(stored_hash) == bytes.fromhex(bitcoind.rpc.getblockhash(103))[::-1]

# Make sure we also have the needle we added to the haystack above
assert(31337 in [r['satoshis'] for r in l3.db_query("SELECT satoshis FROM utxoset")])

Expand Down
Loading