diff --git a/docs/src/apps/jsonrpc-api.md b/docs/src/apps/jsonrpc-api.md index 7510a04caa..72c775044d 100644 --- a/docs/src/apps/jsonrpc-api.md +++ b/docs/src/apps/jsonrpc-api.md @@ -466,6 +466,7 @@ Returns information about the current epoch The result field will be an object with the following fields: - `absoluteSlot: `, the current slot +- `blockHeight: `, the current block height - `epoch: `, the current epoch - `slotIndex: `, the current slot relative to the start of the current epoch - `slotsInEpoch: `, the number of slots in this epoch @@ -477,7 +478,7 @@ The result field will be an object with the following fields: curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1, "method":"getEpochInfo"}' http://localhost:8899 // Result -{"jsonrpc":"2.0","result":{"absoluteSlot":166598,"epoch":27,"slotIndex":2790,"slotsInEpoch":8192},"id":1} +{"jsonrpc":"2.0","result":{"absoluteSlot":166598,"blockHeight": 166500, "epoch":27,"slotIndex":2790,"slotsInEpoch":8192},"id":1} ``` ### getEpochSchedule diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 5b47c6592c..1ef177a897 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -2938,6 +2938,7 @@ impl Bank { pub fn get_epoch_info(&self) -> EpochInfo { let absolute_slot = self.slot(); + let block_height = self.block_height(); let (epoch, slot_index) = self.get_epoch_and_slot_index(absolute_slot); let slots_in_epoch = self.get_slots_in_epoch(epoch); EpochInfo { @@ -2945,6 +2946,7 @@ impl Bank { slot_index, slots_in_epoch, absolute_slot, + block_height, } } diff --git a/sdk/src/epoch_info.rs b/sdk/src/epoch_info.rs index 65de265786..943c4a5513 100644 --- a/sdk/src/epoch_info.rs +++ b/sdk/src/epoch_info.rs @@ -14,4 +14,7 @@ pub struct EpochInfo { /// The absolute current slot pub absolute_slot: Slot, + + /// The current block height + pub block_height: u64, }