Update thinclient to resend the same tx until its blockhash expires (#4807)

This commit is contained in:
Sagar Dhawan
2019-06-24 16:46:34 -07:00
committed by GitHub
parent 70f93cc126
commit 74a06e4230
4 changed files with 27 additions and 13 deletions

View File

@ -22,8 +22,8 @@ use solana_runtime::locked_accounts_results::LockedAccountsResults;
use solana_sdk::poh_config::PohConfig;
use solana_sdk::pubkey::Pubkey;
use solana_sdk::timing::{
self, duration_as_us, DEFAULT_NUM_TICKS_PER_SECOND, DEFAULT_TICKS_PER_SLOT,
MAX_RECENT_BLOCKHASHES, MAX_TRANSACTION_FORWARDING_DELAY,
self, duration_as_us, DEFAULT_NUM_TICKS_PER_SECOND, DEFAULT_TICKS_PER_SLOT, MAX_PROCESSING_AGE,
MAX_TRANSACTION_FORWARDING_DELAY,
};
use solana_sdk::transaction::{self, Transaction, TransactionError};
use std::net::UdpSocket;
@ -423,7 +423,7 @@ impl BankingStage {
// TODO: Banking stage threads should be prioritized to complete faster then this queue
// expires.
let (loaded_accounts, results) =
bank.load_and_execute_transactions(txs, lock_results, MAX_RECENT_BLOCKHASHES / 2);
bank.load_and_execute_transactions(txs, lock_results, MAX_PROCESSING_AGE);
let load_execute_time = now.elapsed();
let freeze_lock = bank.freeze_lock();
@ -620,7 +620,7 @@ impl BankingStage {
let result = bank.check_transactions(
transactions,
&filter,
(MAX_RECENT_BLOCKHASHES / 2)
(MAX_PROCESSING_AGE)
.saturating_sub(MAX_TRANSACTION_FORWARDING_DELAY)
.saturating_sub(
(FORWARD_TRANSACTIONS_TO_LEADER_AT_SLOT_OFFSET * bank.ticks_per_slot()

View File

@ -500,7 +500,11 @@ impl Replicator {
> 0
);
// ...or no lamports for fees
assert!(client.poll_get_balance(&self.keypair.pubkey()).unwrap() > 0);
let balance = client.poll_get_balance(&self.keypair.pubkey()).unwrap();
if balance == 0 {
error!("Unable to submit mining proof, insufficient Replicator Account balance");
return;
}
let (blockhash, _) = client.get_recent_blockhash().expect("No recent blockhash");
let instruction = storage_instruction::mining_proof(