Reduce slot duration and consecutive leader slots (#4838)
* change consecutive leader slots to 4 * reduce polling frequency for transaction signature confirmation * adjust wait time for transaction signature confirmation * fix nominal test * fix flakiness in wallet pay test
This commit is contained in:
@ -446,17 +446,27 @@ impl RpcClient {
|
||||
) -> io::Result<()> {
|
||||
let mut now = Instant::now();
|
||||
let mut confirmed_blocks = 0;
|
||||
let mut wait_time = 15;
|
||||
loop {
|
||||
let response = self.get_num_blocks_since_signature_confirmation(signature);
|
||||
match response {
|
||||
Ok(count) => {
|
||||
if confirmed_blocks != count {
|
||||
info!(
|
||||
"signature {} confirmed {} out of {}",
|
||||
signature, count, min_confirmed_blocks
|
||||
"signature {} confirmed {} out of {} after {} ms",
|
||||
signature,
|
||||
count,
|
||||
min_confirmed_blocks,
|
||||
now.elapsed().as_millis()
|
||||
);
|
||||
now = Instant::now();
|
||||
confirmed_blocks = count;
|
||||
// If the signature has been confirmed once, wait extra while reconfirming it
|
||||
// One confirmation means the transaction has been seen by the network, so
|
||||
// next confirmation (for a higher block count) should come through.
|
||||
// Returning an error prematurely will cause a valid transaction to be deemed
|
||||
// as failure.
|
||||
wait_time = 30;
|
||||
}
|
||||
if count >= min_confirmed_blocks {
|
||||
break;
|
||||
@ -466,11 +476,18 @@ impl RpcClient {
|
||||
debug!("check_confirmations request failed: {:?}", err);
|
||||
}
|
||||
};
|
||||
if now.elapsed().as_secs() > 15 {
|
||||
if now.elapsed().as_secs() > wait_time {
|
||||
info!(
|
||||
"signature {} confirmed {} out of {} failed after {} ms",
|
||||
signature,
|
||||
confirmed_blocks,
|
||||
min_confirmed_blocks,
|
||||
now.elapsed().as_millis()
|
||||
);
|
||||
// TODO: Return a better error.
|
||||
return Err(io::Error::new(io::ErrorKind::Other, "signature not found"));
|
||||
}
|
||||
sleep(Duration::from_millis(250));
|
||||
sleep(Duration::from_secs(1));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
Reference in New Issue
Block a user