Use vote signer service in fullnode (#2009)
* Use vote signer service in fullnode * Use native types for signature and pubkey, and address other review comments * Start local vote signer if a remote service address is not provided * Rebased to master * Fixes after rebase
This commit is contained in:
@ -71,6 +71,21 @@ impl Transaction {
|
||||
instructions,
|
||||
)
|
||||
}
|
||||
pub fn new_unsigned<T: Serialize>(
|
||||
from_pubkey: &Pubkey,
|
||||
transaction_keys: &[Pubkey],
|
||||
program_id: Pubkey,
|
||||
userdata: &T,
|
||||
last_id: Hash,
|
||||
fee: u64,
|
||||
) -> Self {
|
||||
let program_ids = vec![program_id];
|
||||
let accounts = (0..=transaction_keys.len() as u8).collect();
|
||||
let instructions = vec![Instruction::new(0, userdata, accounts)];
|
||||
let mut keys = vec![*from_pubkey];
|
||||
keys.extend_from_slice(transaction_keys);
|
||||
Self::new_with_instructions(&[], &keys[..], last_id, fee, program_ids, instructions)
|
||||
}
|
||||
/// Create a signed transaction
|
||||
/// * `from_keypair` - The key used to sign the transaction. This key is stored as keys[0]
|
||||
/// * `account_keys` - The keys for the transaction. These are the program state
|
||||
|
@ -10,7 +10,7 @@ use crate::vote_program::{self, Vote, VoteInstruction};
|
||||
use bincode::deserialize;
|
||||
|
||||
pub trait VoteTransaction {
|
||||
fn vote_new(vote_account: &Keypair, vote: Vote, last_id: Hash, fee: u64) -> Self;
|
||||
fn vote_new(vote_account: &Pubkey, vote: Vote, last_id: Hash, fee: u64) -> Self;
|
||||
fn vote_account_new(
|
||||
validator_id: &Keypair,
|
||||
vote_account_id: Pubkey,
|
||||
@ -23,9 +23,9 @@ pub trait VoteTransaction {
|
||||
}
|
||||
|
||||
impl VoteTransaction for Transaction {
|
||||
fn vote_new(vote_account: &Keypair, vote: Vote, last_id: Hash, fee: u64) -> Self {
|
||||
fn vote_new(vote_account: &Pubkey, vote: Vote, last_id: Hash, fee: u64) -> Self {
|
||||
let instruction = VoteInstruction::NewVote(vote);
|
||||
Transaction::new(
|
||||
Transaction::new_unsigned(
|
||||
vote_account,
|
||||
&[],
|
||||
vote_program::id(),
|
||||
|
Reference in New Issue
Block a user