feat: return bank/block info with block-related results (#6716)
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
use solana_client::rpc_client::RpcClient;
|
||||
use solana_core::validator::new_validator_for_tests;
|
||||
use solana_sdk::commitment_config::CommitmentConfig;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_sdk::signature::KeypairUtil;
|
||||
use solana_sdk::system_transaction;
|
||||
@ -22,7 +23,6 @@ fn test_rpc_client() {
|
||||
);
|
||||
|
||||
assert_eq!(client.get_balance(&bob_pubkey).unwrap(), 0);
|
||||
|
||||
assert_eq!(client.get_balance(&alice.pubkey()).unwrap(), 10000);
|
||||
|
||||
let (blockhash, _fee_calculator) = client.get_recent_blockhash().unwrap();
|
||||
@ -34,14 +34,13 @@ fn test_rpc_client() {
|
||||
|
||||
let now = Instant::now();
|
||||
while now.elapsed().as_secs() <= 20 {
|
||||
let response = client.confirm_transaction(signature.as_str());
|
||||
let response = client
|
||||
.confirm_transaction_with_commitment(signature.as_str(), CommitmentConfig::default())
|
||||
.unwrap();
|
||||
|
||||
match response {
|
||||
Ok(true) => {
|
||||
confirmed_tx = true;
|
||||
break;
|
||||
}
|
||||
_ => (),
|
||||
if response.value {
|
||||
confirmed_tx = true;
|
||||
break;
|
||||
}
|
||||
|
||||
sleep(Duration::from_millis(500));
|
||||
|
@ -34,7 +34,11 @@ fn test_rpc_send_tx() {
|
||||
.send()
|
||||
.unwrap();
|
||||
let json: Value = serde_json::from_str(&response.text().unwrap()).unwrap();
|
||||
let blockhash: Hash = json["result"][0].as_str().unwrap().parse().unwrap();
|
||||
let blockhash: Hash = json["result"]["value"][0]
|
||||
.as_str()
|
||||
.unwrap()
|
||||
.parse()
|
||||
.unwrap();
|
||||
|
||||
info!("blockhash: {:?}", blockhash);
|
||||
let tx = system_transaction::transfer(&alice, &bob_pubkey, 20, blockhash);
|
||||
@ -78,7 +82,7 @@ fn test_rpc_send_tx() {
|
||||
let response_json_text = response.text().unwrap();
|
||||
let json: Value = serde_json::from_str(&response_json_text).unwrap();
|
||||
|
||||
if true == json["result"] {
|
||||
if true == json["result"]["value"] {
|
||||
confirmed_tx = true;
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user