Check for new vote account signature explicitly for better error reporting on failures

This commit is contained in:
Michael Vines 2019-01-22 11:08:23 -08:00 committed by Grimes
parent 9a7082d0d5
commit f630b50902
1 changed files with 21 additions and 10 deletions

View File

@ -75,19 +75,30 @@ fn create_and_fund_vote_account(
}
loop {
let last_id = client.get_last_id();
info!("create_and_fund_vote_account last_id={:?}", last_id);
let transaction =
VoteTransaction::vote_account_new(node_keypair, vote_account, last_id, 1, 1);
match client.transfer_signed(&transaction) {
Ok(_) => match client.poll_get_balance(&vote_account) {
Ok(balance) => {
info!("vote account balance: {}", balance);
break;
}
Err(e) => {
info!("Failed to get vote account balance: {:?}", e);
}
},
Ok(signature) => {
match client.poll_for_signature(&signature) {
Ok(_) => match client.poll_get_balance(&vote_account) {
Ok(balance) => {
info!("vote account balance: {}", balance);
break;
}
Err(e) => {
info!("Failed to get vote account balance: {:?}", e);
}
},
Err(e) => {
info!(
"vote_account_new signature not found: {:?}: {:?}",
signature, e
);
}
};
}
Err(e) => {
info!("Failed to send vote_account_new transaction: {:?}", e);
}
@ -96,7 +107,7 @@ fn create_and_fund_vote_account(
}
}
debug!("Checking for vote account registration");
info!("Checking for vote account registration");
let vote_account_user_data = client.get_account_userdata(&vote_account);
if let Ok(Some(vote_account_user_data)) = vote_account_user_data {
if let Ok(vote_state) = VoteProgram::deserialize(&vote_account_user_data) {