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:
galactus 2023-09-26 17:27:45 +02:00 committed by GitHub
commit d938e70d75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 6 deletions

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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 {