RpcClient: include signature check in send_transaction, bump send retries in get_num_blocks_since_signature_confirmation (#9341) (#9346)

automerge
This commit is contained in:
mergify[bot]
2020-04-06 20:24:27 -07:00
committed by GitHub
parent 15631f8194
commit 6ea74c3d29
3 changed files with 67 additions and 57 deletions

View File

@@ -3200,7 +3200,7 @@ mod tests {
let process_id = Pubkey::new_rand();
config.command = CliCommand::Cancel(process_id);
assert_eq!(process_command(&config).unwrap(), SIGNATURE);
assert!(process_command(&config).is_ok());
let good_signature = Signature::new(&bs58::decode(SIGNATURE).into_vec().unwrap());
config.command = CliCommand::Confirm(good_signature);
@@ -3217,8 +3217,8 @@ mod tests {
commission: 0,
};
config.signers = vec![&keypair, &bob_keypair, &identity_keypair];
let signature = process_command(&config);
assert_eq!(signature.unwrap(), SIGNATURE.to_string());
let result = process_command(&config);
assert!(result.is_ok());
let new_authorized_pubkey = Pubkey::new_rand();
config.signers = vec![&bob_keypair];
@@ -3227,8 +3227,8 @@ mod tests {
new_authorized_pubkey,
vote_authorize: VoteAuthorize::Voter,
};
let signature = process_command(&config);
assert_eq!(signature.unwrap(), SIGNATURE.to_string());
let result = process_command(&config);
assert!(result.is_ok());
let new_identity_keypair = Keypair::new();
config.signers = vec![&keypair, &bob_keypair, &new_identity_keypair];
@@ -3236,8 +3236,8 @@ mod tests {
vote_account_pubkey: bob_pubkey,
new_identity_account: 2,
};
let signature = process_command(&config);
assert_eq!(signature.unwrap(), SIGNATURE.to_string());
let result = process_command(&config);
assert!(result.is_ok());
let bob_keypair = Keypair::new();
let bob_pubkey = bob_keypair.pubkey();
@@ -3261,8 +3261,8 @@ mod tests {
from: 0,
};
config.signers = vec![&keypair, &bob_keypair];
let signature = process_command(&config);
assert_eq!(signature.unwrap(), SIGNATURE.to_string());
let result = process_command(&config);
assert!(result.is_ok());
let stake_pubkey = Pubkey::new_rand();
let to_pubkey = Pubkey::new_rand();
@@ -3278,8 +3278,8 @@ mod tests {
fee_payer: 0,
};
config.signers = vec![&keypair];
let signature = process_command(&config);
assert_eq!(signature.unwrap(), SIGNATURE.to_string());
let result = process_command(&config);
assert!(result.is_ok());
let stake_pubkey = Pubkey::new_rand();
config.command = CliCommand::DeactivateStake {
@@ -3291,8 +3291,8 @@ mod tests {
nonce_authority: 0,
fee_payer: 0,
};
let signature = process_command(&config);
assert_eq!(signature.unwrap(), SIGNATURE.to_string());
let result = process_command(&config);
assert!(result.is_ok());
let stake_pubkey = Pubkey::new_rand();
let split_stake_account = Keypair::new();
@@ -3309,8 +3309,8 @@ mod tests {
fee_payer: 0,
};
config.signers = vec![&keypair, &split_stake_account];
let signature = process_command(&config);
assert_eq!(signature.unwrap(), SIGNATURE.to_string());
let result = process_command(&config);
assert!(result.is_ok());
config.command = CliCommand::GetSlot {
commitment_config: CommitmentConfig::default(),
@@ -3328,8 +3328,8 @@ mod tests {
to: bob_pubkey,
..PayCommand::default()
});
let signature = process_command(&config);
assert_eq!(signature.unwrap(), SIGNATURE.to_string());
let result = process_command(&config);
assert!(result.is_ok());
let date_string = "\"2018-09-19T17:30:59Z\"";
let dt: DateTime<Utc> = serde_json::from_str(&date_string).unwrap();
@@ -3341,16 +3341,7 @@ mod tests {
..PayCommand::default()
});
let result = process_command(&config);
let json: Value = serde_json::from_str(&result.unwrap()).unwrap();
assert_eq!(
json.as_object()
.unwrap()
.get("signature")
.unwrap()
.as_str()
.unwrap(),
SIGNATURE.to_string()
);
assert!(result.is_ok());
let witness = Pubkey::new_rand();
config.command = CliCommand::Pay(PayCommand {
@@ -3361,27 +3352,18 @@ mod tests {
..PayCommand::default()
});
let result = process_command(&config);
let json: Value = serde_json::from_str(&result.unwrap()).unwrap();
assert_eq!(
json.as_object()
.unwrap()
.get("signature")
.unwrap()
.as_str()
.unwrap(),
SIGNATURE.to_string()
);
assert!(result.is_ok());
let process_id = Pubkey::new_rand();
config.command = CliCommand::TimeElapsed(bob_pubkey, process_id, dt);
config.signers = vec![&keypair];
let signature = process_command(&config);
assert_eq!(signature.unwrap(), SIGNATURE.to_string());
let result = process_command(&config);
assert!(result.is_ok());
let witness = Pubkey::new_rand();
config.command = CliCommand::Witness(bob_pubkey, witness);
let signature = process_command(&config);
assert_eq!(signature.unwrap(), SIGNATURE.to_string());
let result = process_command(&config);
assert!(result.is_ok());
// CreateAddressWithSeed
let from_pubkey = Pubkey::new_rand();
@@ -3408,13 +3390,13 @@ mod tests {
assert!(process_command(&config).is_ok());
config.command = CliCommand::TimeElapsed(bob_pubkey, process_id, dt);
let signature = process_command(&config);
assert_eq!(signature.unwrap(), SIGNATURE.to_string());
let result = process_command(&config);
assert!(result.is_ok());
let witness = Pubkey::new_rand();
config.command = CliCommand::Witness(bob_pubkey, witness);
let signature = process_command(&config);
assert_eq!(signature.unwrap(), SIGNATURE.to_string());
let result = process_command(&config);
assert!(result.is_ok());
// sig_not_found case
config.rpc_client = Some(RpcClient::new_mock("sig_not_found".to_string()));