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 {
|
||||
txs,
|
||||
transactions: txs,
|
||||
block_height: block
|
||||
.block_height
|
||||
.map(|block_height| block_height.block_height)
|
||||
.unwrap(),
|
||||
block_time: block.block_time.map(|time| time.timestamp).unwrap() as u64,
|
||||
blockhash: block.blockhash,
|
||||
previous_blockhash: block.parent_blockhash,
|
||||
commitment_config,
|
||||
leader_id,
|
||||
parent_slot: block.parent_slot,
|
||||
|
|
|
@ -20,7 +20,7 @@ pub struct TransactionInfo {
|
|||
|
||||
#[derive(Default, Debug, Clone)]
|
||||
pub struct ProducedBlock {
|
||||
pub txs: Vec<TransactionInfo>,
|
||||
pub transactions: Vec<TransactionInfo>,
|
||||
pub leader_id: Option<String>,
|
||||
pub blockhash: String,
|
||||
pub block_height: u64,
|
||||
|
@ -28,6 +28,7 @@ pub struct ProducedBlock {
|
|||
pub parent_slot: Slot,
|
||||
pub block_time: u64,
|
||||
pub commitment_config: CommitmentConfig,
|
||||
pub previous_blockhash: String,
|
||||
}
|
||||
|
||||
impl ProducedBlock {
|
||||
|
@ -40,6 +41,7 @@ impl ProducedBlock {
|
|||
let txs = block.transactions.unwrap_or_default();
|
||||
|
||||
let blockhash = block.blockhash;
|
||||
let previous_blockhash = block.previous_blockhash;
|
||||
let parent_slot = block.parent_slot;
|
||||
|
||||
let txs = txs
|
||||
|
@ -139,10 +141,11 @@ impl ProducedBlock {
|
|||
let block_time = block.block_time.unwrap_or(0) as u64;
|
||||
|
||||
ProducedBlock {
|
||||
txs,
|
||||
transactions: txs,
|
||||
block_height,
|
||||
leader_id,
|
||||
blockhash,
|
||||
previous_blockhash,
|
||||
parent_slot,
|
||||
block_time,
|
||||
slot,
|
||||
|
|
|
@ -11,8 +11,9 @@ pub fn create_test_block(slot: u64, commitment_config: CommitmentConfig) -> Prod
|
|||
ProducedBlock {
|
||||
block_height: slot,
|
||||
blockhash: Hash::new_unique().to_string(),
|
||||
previous_blockhash: Hash::new_unique().to_string(),
|
||||
parent_slot: slot - 1,
|
||||
txs: vec![],
|
||||
transactions: vec![],
|
||||
block_time: 0,
|
||||
commitment_config,
|
||||
leader_id: None,
|
||||
|
|
|
@ -14,8 +14,9 @@ pub fn create_test_block(slot: u64, commitment_config: CommitmentConfig) -> Prod
|
|||
ProducedBlock {
|
||||
block_height: slot,
|
||||
blockhash: Hash::new_unique().to_string(),
|
||||
previous_blockhash: Hash::new_unique().to_string(),
|
||||
parent_slot: slot - 1,
|
||||
txs: vec![],
|
||||
transactions: vec![],
|
||||
block_time: 0,
|
||||
commitment_config,
|
||||
leader_id: None,
|
||||
|
|
|
@ -63,7 +63,7 @@ impl DataCachingService {
|
|||
_ => TransactionConfirmationStatus::Processed,
|
||||
};
|
||||
|
||||
for tx in block.txs {
|
||||
for tx in block.transactions {
|
||||
if data_cache.txs.update_status(
|
||||
&tx.signature,
|
||||
TransactionStatus {
|
||||
|
|
Loading…
Reference in New Issue