Skip to content

[Bug] Missing fields in getblockheader rpc #606

@qlrd

Description

@qlrd

Describe the bug
While refactoring a test for getblockheader JSONrpc test, it was noted that floresta response has missing fields in response, namely mediantime, target, chainwork and nTx.

Steps to Reproduce

Start a florestad and a bitcoind, both in regtest and then call:

$> BLOCKHASH=$(floresta-cli --network regtest getblockhash 0)
$> floresta-cli --network regtest getblockheader $BLOCKHASH
$> bitcoin-cli -network regtest getblockheader $BLOCKHASH

Expected behavior

floresta-cli should comply with Bitcoin-Core and return a json like:

--- floresta.json
+++ bitcoin-core.json
 {
   'hash': '0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206',
   'confirmations': 11,
   'height': 0,
   'version': 1,
   'versionHex': '00000001',
   'merkleroot': '4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b',
   'time': 1296688602,
+  'mediantime': 1296688602,
   'nonce': 2,
   'bits': '207fffff',
+  'target': '7fffff0000000000000000000000000000000000000000000000000000000000',
-  'difficulty': 1,
+  'difficulty': 4.656542373906925e-10,
+  'chainwork': '0000000000000000000000000000000000000000000000000000000000000002',
+  'nTx': 1,
-  'previousblockhash': '0000000000000000000000000000000000000000000000000000000000000000',
   'nextblockhash': '369bec98e6b8ad7b2a46c20374823d75cf0792e6e8ef9287bfc256c3021de87f'
 }

Build environment

version v0.8.0-20-geafa9d1-dirty compiled for aarch64-macos- with rustc 1.90.0-nightly (ba7e63b63 2025-07-29)

Additional context
Related with #590

Metadata

Metadata

Assignees

No one assigned

    Labels

    compatibilityreliabilityRelated to runtime reliability, stability and production readiness

    Type

    Projects

    Status

    Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions