diff --git a/chronik/chronik-bridge/src/ffi.rs b/chronik/chronik-bridge/src/ffi.rs --- a/chronik/chronik-bridge/src/ffi.rs +++ b/chronik/chronik-bridge/src/ffi.rs @@ -52,6 +52,8 @@ pub data_pos: u32, /// Position of the undo data within the undo file. pub undo_pos: u32, + /// Serialized size of the block + pub size: u64, /// Txs of this block, including positions within the block/undo files. pub txs: Vec, } 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,6 +149,7 @@ .file_num = uint32_t(bindex.nFile), .data_pos = bindex.nDataPos, .undo_pos = bindex.nUndoPos, + .size = bindex.nSize, .txs = bridged_txs}; } diff --git a/chronik/test/bridgeprimitives_tests.cpp b/chronik/test/bridgeprimitives_tests.cpp --- a/chronik/test/bridgeprimitives_tests.cpp +++ b/chronik/test/bridgeprimitives_tests.cpp @@ -64,6 +64,7 @@ BOOST_CHECK_EQUAL(left.file_num, right.file_num); BOOST_CHECK_EQUAL(left.data_pos, right.data_pos); BOOST_CHECK_EQUAL(left.undo_pos, right.undo_pos); + BOOST_CHECK_EQUAL(left.size, right.size); BOOST_CHECK_EQUAL(left.txs.size(), right.txs.size()); for (size_t txIdx = 0; txIdx < left.txs.size(); ++txIdx) { @@ -144,6 +145,7 @@ .file_num = 0, .data_pos = 8, // 8 magic bytes in block file .undo_pos = 0, // genesis has no undo data + .size = 285, .txs = {{ .tx = expectedGenesisTx, .data_pos = 89, // +80 header +1 compact size @@ -296,6 +298,7 @@ .file_num = 0, .data_pos = 39948, .undo_pos = 8249, + .size = 578, .txs = { {.tx = expectedTestTx0, .data_pos = 40029, .undo_pos = 0}, {.tx = expectedTestTx1, .data_pos = 40129, .undo_pos = 8250},