Add block time placeholder to getConfirmedBlock
This commit is contained in:
parent
ae6aaab4d8
commit
491f5ae61a
|
@ -314,6 +314,7 @@ The result field will be an object with the following fields:
|
|||
* `rewards: <array>` - an array of JSON objects containing:
|
||||
* `pubkey: <string>` - The public key, as base-58 encoded string, of the account that received the reward
|
||||
* `lamports: <i64>`- number of reward lamports credited or debited by the account, as a i64
|
||||
* `blockTime: <i64 | null>` - estimated production time, as Unix timestamp (seconds since the Unix epoch). null if not available
|
||||
|
||||
#### Example:
|
||||
|
||||
|
|
|
@ -1641,6 +1641,7 @@ impl Blockstore {
|
|||
slot_transaction_iterator,
|
||||
),
|
||||
rewards,
|
||||
block_time: None, // See https://github.com/solana-labs/solana/issues/10089
|
||||
};
|
||||
return Ok(block);
|
||||
}
|
||||
|
@ -5244,6 +5245,7 @@ pub mod tests {
|
|||
blockhash: blockhash.to_string(),
|
||||
previous_blockhash: Hash::default().to_string(),
|
||||
rewards: vec![],
|
||||
block_time: None,
|
||||
};
|
||||
// The previous_blockhash of `expected_block` is default because its parent slot is a
|
||||
// root, but empty of entries. This is special handling for snapshot root slots.
|
||||
|
@ -5265,6 +5267,7 @@ pub mod tests {
|
|||
blockhash: blockhash.to_string(),
|
||||
previous_blockhash: blockhash.to_string(),
|
||||
rewards: vec![],
|
||||
block_time: None,
|
||||
};
|
||||
assert_eq!(confirmed_block, expected_block);
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ pub mod parse_instruction;
|
|||
use crate::{parse_accounts::parse_accounts, parse_instruction::parse};
|
||||
use serde_json::Value;
|
||||
use solana_sdk::{
|
||||
clock::Slot,
|
||||
clock::{Slot, UnixTimestamp},
|
||||
commitment_config::CommitmentConfig,
|
||||
instruction::CompiledInstruction,
|
||||
message::MessageHeader,
|
||||
|
@ -118,6 +118,7 @@ pub struct ConfirmedBlock {
|
|||
pub parent_slot: Slot,
|
||||
pub transactions: Vec<TransactionWithStatusMeta>,
|
||||
pub rewards: Rewards,
|
||||
pub block_time: Option<UnixTimestamp>,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
|
|
Loading…
Reference in New Issue