Stop using LocalVoteSigner
This commit is contained in:
@ -18,7 +18,6 @@ use crate::service::Service;
|
||||
use crate::storage_stage::StorageState;
|
||||
use crate::tpu::Tpu;
|
||||
use crate::tvu::{Sockets, Tvu};
|
||||
use crate::voting_keypair::VotingKeypair;
|
||||
use solana_metrics::counter::Counter;
|
||||
use solana_sdk::genesis_block::GenesisBlock;
|
||||
use solana_sdk::hash::Hash;
|
||||
@ -335,7 +334,7 @@ pub fn make_active_set_entries(
|
||||
slot_height_to_vote_on: u64,
|
||||
blockhash: &Hash,
|
||||
num_ending_ticks: u64,
|
||||
) -> (Vec<Entry>, VotingKeypair) {
|
||||
) -> (Vec<Entry>, Keypair) {
|
||||
// 1) Assume the active_keypair node has no tokens staked
|
||||
let transfer_tx = SystemTransaction::new_account(
|
||||
&token_source,
|
||||
@ -348,7 +347,7 @@ pub fn make_active_set_entries(
|
||||
let transfer_entry = next_entry_mut(&mut last_entry_hash, 1, vec![transfer_tx]);
|
||||
|
||||
// 2) Create and register a vote account for active_keypair
|
||||
let voting_keypair = VotingKeypair::new_local(active_keypair);
|
||||
let voting_keypair = Keypair::new();
|
||||
let vote_account_id = voting_keypair.pubkey();
|
||||
|
||||
let new_vote_account_tx = VoteTransaction::new_account(
|
||||
|
@ -113,7 +113,6 @@ impl LeaderConfirmationService {
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::voting_keypair::tests::{new_vote_account, push_vote};
|
||||
use crate::voting_keypair::VotingKeypair;
|
||||
use bincode::serialize;
|
||||
use solana_sdk::genesis_block::GenesisBlock;
|
||||
use solana_sdk::hash::hash;
|
||||
@ -142,7 +141,7 @@ mod tests {
|
||||
.map(|i| {
|
||||
// Create new validator to vote
|
||||
let validator_keypair = Arc::new(Keypair::new());
|
||||
let voting_keypair = VotingKeypair::new_local(&validator_keypair);
|
||||
let voting_keypair = Keypair::new();
|
||||
let voting_pubkey = voting_keypair.pubkey();
|
||||
|
||||
// Give the validator some tokens
|
||||
|
@ -6,7 +6,6 @@ use crate::gossip_service::discover;
|
||||
use crate::service::Service;
|
||||
use crate::thin_client::retry_get_balance;
|
||||
use crate::thin_client::ThinClient;
|
||||
use crate::voting_keypair::VotingKeypair;
|
||||
use solana_sdk::genesis_block::GenesisBlock;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_sdk::signature::{Keypair, KeypairUtil};
|
||||
@ -52,7 +51,7 @@ impl LocalCluster {
|
||||
let mut ledger_paths = vec![];
|
||||
ledger_paths.push(genesis_ledger_path.clone());
|
||||
ledger_paths.push(leader_ledger_path.clone());
|
||||
let voting_keypair = VotingKeypair::new_local(&leader_keypair);
|
||||
let voting_keypair = Keypair::new();
|
||||
let leader_node_info = leader_node.info.clone();
|
||||
let leader_server = Fullnode::new(
|
||||
leader_node,
|
||||
@ -66,7 +65,7 @@ impl LocalCluster {
|
||||
let mut client = mk_client(&leader_node_info);
|
||||
for _ in 0..(num_nodes - 1) {
|
||||
let validator_keypair = Arc::new(Keypair::new());
|
||||
let voting_keypair = VotingKeypair::new_local(&validator_keypair);
|
||||
let voting_keypair = Keypair::new();
|
||||
let validator_pubkey = validator_keypair.pubkey();
|
||||
let validator_node = Node::new_localhost_with_pubkey(validator_keypair.pubkey());
|
||||
let ledger_path = tmp_copy_blocktree!(&genesis_ledger_path);
|
||||
|
@ -473,7 +473,6 @@ pub fn new_fullnode() -> (Fullnode, NodeInfo, Keypair, String) {
|
||||
use crate::blocktree::create_new_tmp_ledger;
|
||||
use crate::cluster_info::Node;
|
||||
use crate::fullnode::Fullnode;
|
||||
use crate::voting_keypair::VotingKeypair;
|
||||
use solana_sdk::genesis_block::GenesisBlock;
|
||||
use solana_sdk::signature::KeypairUtil;
|
||||
|
||||
@ -484,8 +483,7 @@ pub fn new_fullnode() -> (Fullnode, NodeInfo, Keypair, String) {
|
||||
let (genesis_block, mint_keypair) = GenesisBlock::new_with_leader(10_000, node_info.id, 42);
|
||||
let (ledger_path, _blockhash) = create_new_tmp_ledger!(&genesis_block);
|
||||
|
||||
let vote_account_keypair = Arc::new(Keypair::new());
|
||||
let voting_keypair = VotingKeypair::new_local(&vote_account_keypair);
|
||||
let voting_keypair = Keypair::new();
|
||||
let node = Fullnode::new(
|
||||
node,
|
||||
&node_keypair,
|
||||
|
@ -57,7 +57,10 @@ impl VoteSigner for RemoteVoteSigner {
|
||||
impl KeypairUtil for VotingKeypair {
|
||||
/// Return a local VotingKeypair with a new keypair. Used for unit-tests.
|
||||
fn new() -> Self {
|
||||
Self::new_local(&Arc::new(Keypair::new()))
|
||||
Self::new_with_signer(
|
||||
&Arc::new(Keypair::new()),
|
||||
Box::new(LocalVoteSigner::default()),
|
||||
)
|
||||
}
|
||||
|
||||
/// Return the public key of the keypair used to sign votes
|
||||
@ -90,10 +93,6 @@ impl VotingKeypair {
|
||||
vote_account,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_local(keypair: &Arc<Keypair>) -> Self {
|
||||
Self::new_with_signer(keypair, Box::new(LocalVoteSigner::default()))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
Reference in New Issue
Block a user