pass Pubkeys as refs, copy only where values needed (#3213)
* pass Pubkeys as refs, copy only where values needed * Pubkey is pervasive * fixup
This commit is contained in:
@@ -9,11 +9,11 @@ pub enum RewardsInstruction {
|
||||
}
|
||||
|
||||
impl RewardsInstruction {
|
||||
pub fn new_redeem_vote_credits(vote_id: Pubkey, rewards_id: Pubkey) -> BuilderInstruction {
|
||||
pub fn new_redeem_vote_credits(vote_id: &Pubkey, rewards_id: &Pubkey) -> BuilderInstruction {
|
||||
BuilderInstruction::new(
|
||||
id(),
|
||||
&RewardsInstruction::RedeemVoteCredits,
|
||||
vec![(vote_id, true), (rewards_id, false)],
|
||||
vec![(*vote_id, true), (*rewards_id, false)],
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@@ -17,7 +17,7 @@ pub struct RewardsTransaction {}
|
||||
impl RewardsTransaction {
|
||||
pub fn new_account(
|
||||
from_keypair: &Keypair,
|
||||
rewards_id: Pubkey,
|
||||
rewards_id: &Pubkey,
|
||||
blockhash: Hash,
|
||||
lamports: u64,
|
||||
fee: u64,
|
||||
@@ -28,23 +28,23 @@ impl RewardsTransaction {
|
||||
blockhash,
|
||||
lamports,
|
||||
RewardsState::max_size() as u64,
|
||||
id(),
|
||||
&id(),
|
||||
fee,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn new_redeem_credits(
|
||||
vote_keypair: &Keypair,
|
||||
rewards_id: Pubkey,
|
||||
rewards_id: &Pubkey,
|
||||
blockhash: Hash,
|
||||
fee: u64,
|
||||
) -> Transaction {
|
||||
let vote_id = vote_keypair.pubkey();
|
||||
TransactionBuilder::new(fee)
|
||||
.push(RewardsInstruction::new_redeem_vote_credits(
|
||||
vote_id, rewards_id,
|
||||
&vote_id, rewards_id,
|
||||
))
|
||||
.push(VoteInstruction::new_clear_credits(vote_id))
|
||||
.push(VoteInstruction::new_clear_credits(&vote_id))
|
||||
.sign(&[vote_keypair], blockhash)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user