Merge pull request #212 from blockworks-foundation/adding_previous_bh_and_renaming_txs
adding previous blockhash and renaming txs to transactions
This commit is contained in:
commit
d938e70d75
|
@ -228,13 +228,14 @@ fn process_block(
|
||||||
};
|
};
|
||||||
|
|
||||||
ProducedBlock {
|
ProducedBlock {
|
||||||
txs,
|
transactions: txs,
|
||||||
block_height: block
|
block_height: block
|
||||||
.block_height
|
.block_height
|
||||||
.map(|block_height| block_height.block_height)
|
.map(|block_height| block_height.block_height)
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
block_time: block.block_time.map(|time| time.timestamp).unwrap() as u64,
|
block_time: block.block_time.map(|time| time.timestamp).unwrap() as u64,
|
||||||
blockhash: block.blockhash,
|
blockhash: block.blockhash,
|
||||||
|
previous_blockhash: block.parent_blockhash,
|
||||||
commitment_config,
|
commitment_config,
|
||||||
leader_id,
|
leader_id,
|
||||||
parent_slot: block.parent_slot,
|
parent_slot: block.parent_slot,
|
||||||
|
|
|
@ -20,7 +20,7 @@ pub struct TransactionInfo {
|
||||||
|
|
||||||
#[derive(Default, Debug, Clone)]
|
#[derive(Default, Debug, Clone)]
|
||||||
pub struct ProducedBlock {
|
pub struct ProducedBlock {
|
||||||
pub txs: Vec<TransactionInfo>,
|
pub transactions: Vec<TransactionInfo>,
|
||||||
pub leader_id: Option<String>,
|
pub leader_id: Option<String>,
|
||||||
pub blockhash: String,
|
pub blockhash: String,
|
||||||
pub block_height: u64,
|
pub block_height: u64,
|
||||||
|
@ -28,6 +28,7 @@ pub struct ProducedBlock {
|
||||||
pub parent_slot: Slot,
|
pub parent_slot: Slot,
|
||||||
pub block_time: u64,
|
pub block_time: u64,
|
||||||
pub commitment_config: CommitmentConfig,
|
pub commitment_config: CommitmentConfig,
|
||||||
|
pub previous_blockhash: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ProducedBlock {
|
impl ProducedBlock {
|
||||||
|
@ -40,6 +41,7 @@ impl ProducedBlock {
|
||||||
let txs = block.transactions.unwrap_or_default();
|
let txs = block.transactions.unwrap_or_default();
|
||||||
|
|
||||||
let blockhash = block.blockhash;
|
let blockhash = block.blockhash;
|
||||||
|
let previous_blockhash = block.previous_blockhash;
|
||||||
let parent_slot = block.parent_slot;
|
let parent_slot = block.parent_slot;
|
||||||
|
|
||||||
let txs = txs
|
let txs = txs
|
||||||
|
@ -139,10 +141,11 @@ impl ProducedBlock {
|
||||||
let block_time = block.block_time.unwrap_or(0) as u64;
|
let block_time = block.block_time.unwrap_or(0) as u64;
|
||||||
|
|
||||||
ProducedBlock {
|
ProducedBlock {
|
||||||
txs,
|
transactions: txs,
|
||||||
block_height,
|
block_height,
|
||||||
leader_id,
|
leader_id,
|
||||||
blockhash,
|
blockhash,
|
||||||
|
previous_blockhash,
|
||||||
parent_slot,
|
parent_slot,
|
||||||
block_time,
|
block_time,
|
||||||
slot,
|
slot,
|
||||||
|
|
|
@ -11,8 +11,9 @@ pub fn create_test_block(slot: u64, commitment_config: CommitmentConfig) -> Prod
|
||||||
ProducedBlock {
|
ProducedBlock {
|
||||||
block_height: slot,
|
block_height: slot,
|
||||||
blockhash: Hash::new_unique().to_string(),
|
blockhash: Hash::new_unique().to_string(),
|
||||||
|
previous_blockhash: Hash::new_unique().to_string(),
|
||||||
parent_slot: slot - 1,
|
parent_slot: slot - 1,
|
||||||
txs: vec![],
|
transactions: vec![],
|
||||||
block_time: 0,
|
block_time: 0,
|
||||||
commitment_config,
|
commitment_config,
|
||||||
leader_id: None,
|
leader_id: None,
|
||||||
|
|
|
@ -14,8 +14,9 @@ pub fn create_test_block(slot: u64, commitment_config: CommitmentConfig) -> Prod
|
||||||
ProducedBlock {
|
ProducedBlock {
|
||||||
block_height: slot,
|
block_height: slot,
|
||||||
blockhash: Hash::new_unique().to_string(),
|
blockhash: Hash::new_unique().to_string(),
|
||||||
|
previous_blockhash: Hash::new_unique().to_string(),
|
||||||
parent_slot: slot - 1,
|
parent_slot: slot - 1,
|
||||||
txs: vec![],
|
transactions: vec![],
|
||||||
block_time: 0,
|
block_time: 0,
|
||||||
commitment_config,
|
commitment_config,
|
||||||
leader_id: None,
|
leader_id: None,
|
||||||
|
|
|
@ -63,7 +63,7 @@ impl DataCachingService {
|
||||||
_ => TransactionConfirmationStatus::Processed,
|
_ => TransactionConfirmationStatus::Processed,
|
||||||
};
|
};
|
||||||
|
|
||||||
for tx in block.txs {
|
for tx in block.transactions {
|
||||||
if data_cache.txs.update_status(
|
if data_cache.txs.update_status(
|
||||||
&tx.signature,
|
&tx.signature,
|
||||||
TransactionStatus {
|
TransactionStatus {
|
||||||
|
|
Loading…
Reference in New Issue