Add vote instructions that directly update on chain vote state (#21531)

* Add vote state instructions

UpdateVoteState and UpdateVoteStateSwitch

* cargo tree

* extract vote state version conversion to common fn
This commit is contained in:
Ashwin Sekar
2021-12-07 16:47:26 -08:00
committed by GitHub
parent 1df88837c8
commit f0acf7681e
18 changed files with 591 additions and 103 deletions

View File

@ -1042,7 +1042,7 @@ impl ClusterInfo {
"invalid vote index: {}, switch: {}, vote slots: {:?}, tower: {:?}",
vote_index,
hash.is_some(),
vote.slots,
vote.slots(),
tower
);
}

View File

@ -306,8 +306,8 @@ impl Sanitize for Vote {
impl Vote {
pub fn new(from: Pubkey, transaction: Transaction, wallclock: u64) -> Self {
let slot = parse_vote_transaction(&transaction)
.and_then(|(_, vote, _)| vote.slots.last().copied());
let slot =
parse_vote_transaction(&transaction).and_then(|(_, vote, _)| vote.last_voted_slot());
Self {
from,
transaction,