Page MenuHomePhabricator

D13981.id40579.diff
No OneTemporary

D13981.id40579.diff

diff --git a/chronik/chronik-cpp/chronik_bridge.cpp b/chronik/chronik-cpp/chronik_bridge.cpp
--- a/chronik/chronik-cpp/chronik_bridge.cpp
+++ b/chronik/chronik-cpp/chronik_bridge.cpp
@@ -149,7 +149,7 @@
.file_num = uint32_t(bindex.nFile),
.data_pos = bindex.nDataPos,
.undo_pos = bindex.nUndoPos,
- .size = bindex.nSize,
+ .size = ::GetSerializeSize(block),
.txs = bridged_txs};
}
diff --git a/test/functional/chronik_block.py b/test/functional/chronik_block.py
--- a/test/functional/chronik_block.py
+++ b/test/functional/chronik_block.py
@@ -77,31 +77,36 @@
node, 100, ADDRESS_ECREG_P2SH_OP_TRUE
)
+ expected_proto_blocks = []
for i in range(1, 101):
proto_block = chronik.block(i).ok()
- assert_equal(
- proto_block,
- pb.Block(
- block_info=pb.BlockInfo(
- hash=bytes.fromhex(block_hashes[i])[::-1],
- prev_hash=bytes.fromhex(block_hashes[i - 1])[::-1],
- height=i,
- n_bits=0x207FFFFF,
- timestamp=proto_block.block_info.timestamp,
- block_size=181,
- num_txs=1,
- num_inputs=1,
- num_outputs=1,
- sum_input_sats=0,
- sum_coinbase_output_sats=5000000000,
- sum_normal_output_sats=0,
- sum_burned_sats=0,
- ),
+ expected_proto = pb.Block(
+ block_info=pb.BlockInfo(
+ hash=bytes.fromhex(block_hashes[i])[::-1],
+ prev_hash=bytes.fromhex(block_hashes[i - 1])[::-1],
+ height=i,
+ n_bits=0x207FFFFF,
+ timestamp=proto_block.block_info.timestamp,
+ block_size=181,
+ num_txs=1,
+ num_inputs=1,
+ num_outputs=1,
+ sum_input_sats=0,
+ sum_coinbase_output_sats=5000000000,
+ sum_normal_output_sats=0,
+ sum_burned_sats=0,
),
)
+ expected_proto_blocks.append(expected_proto)
+ assert_equal(proto_block, expected_proto)
assert_equal(proto_block, chronik.block(block_hashes[i]).ok())
block_hashes.append(proto_block.block_info.hash)
+ # Using -chronikreindex results in the same data
+ self.restart_node(0, ["-chronik", "-chronikreindex"])
+ for i in range(1, 101):
+ assert_equal(chronik.block(i).ok(), expected_proto_blocks[i - 1])
+
# Invalidate in the middle of the chain
node.invalidateblock(block_hashes[50])
# Gives 404 for the invalidated blocks

File Metadata

Mime Type
text/plain
Expires
Tue, May 20, 20:13 (6 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5864939
Default Alt Text
D13981.id40579.diff (2 KB)

Event Timeline