Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14864330
D13981.id40593.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
D13981.id40593.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Tue, May 20, 18:49 (2 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5864939
Default Alt Text
D13981.id40593.diff (2 KB)
Attached To
D13981: [Chronik] Fix: Indexed block size is 0 when running `-chronikindex`
Event Timeline
Log In to Comment