Add parent slot to getConfirmedBlock (#7038)

* Add parent slot to getConfirmedBlock

* Fix bad text-replace

* Use camelCase in getConfirmedBlock
This commit is contained in:
Tyera Eulberg 2019-11-19 09:39:55 -07:00 committed by GitHub
parent 5b7bd24f0a
commit ea656b1a3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 1 deletions

View File

@ -23,9 +23,11 @@ pub struct Response<T> {
}
#[derive(Debug, Default, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct RpcConfirmedBlock {
pub previous_blockhash: Hash,
pub blockhash: Hash,
pub parent_slot: Slot,
pub transactions: Vec<(Transaction, Option<RpcTransactionStatus>)>,
}

View File

@ -512,7 +512,7 @@ pub trait RpcSol {
#[rpc(meta, name = "setLogFilter")]
fn set_log_filter(&self, _meta: Self::Metadata, filter: String) -> Result<()>;
#[rpc(meta, name = "getRpcConfirmedBlock")]
#[rpc(meta, name = "getConfirmedBlock")]
fn get_confirmed_block(
&self,
meta: Self::Metadata,

View File

@ -1148,6 +1148,7 @@ impl Blocktree {
.expect("Rooted parent slot must have blockhash"),
blockhash: get_last_hash(slot_entries.iter())
.expect("Rooted slot must have blockhash"),
parent_slot: slot_meta.parent_slot,
transactions: self.map_transactions_to_statuses(slot, slot_transaction_iterator),
};
Ok(block)

View File

@ -124,6 +124,7 @@ fn get_program_ids(instructions: &[Instruction]) -> Vec<Pubkey> {
}
#[derive(Serialize, Deserialize, Default, Debug, PartialEq, Eq, Clone)]
#[serde(rename_all = "camelCase")]
pub struct MessageHeader {
/// The number of signatures required for this message to be considered valid. The
/// signatures must match the first `num_required_signatures` of `account_keys`.
@ -141,6 +142,7 @@ pub struct MessageHeader {
}
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Message {
/// The message header, identifying signed and read-only `account_keys`
/// NOTE: Serialization-related changes must be paired with the direct read at sigverify.