Label tuple with AccountMeta

This commit is contained in:
Greg Fitzgerald
2019-03-19 13:03:20 -06:00
parent 7246d72f03
commit a4652a9aaf
10 changed files with 83 additions and 68 deletions

View File

@ -67,6 +67,7 @@ impl<'a> BankClient<'a> {
mod tests {
use super::*;
use solana_sdk::genesis_block::GenesisBlock;
use solana_sdk::transaction::AccountMeta;
#[test]
fn test_bank_client_new_with_keypairs() {
@ -81,7 +82,9 @@ mod tests {
let bob_pubkey = Keypair::new().pubkey();
let mut move_instruction =
SystemInstruction::new_move(&doe_client.pubkey(), &bob_pubkey, 42);
move_instruction.accounts.push((jane_pubkey, true));
move_instruction
.accounts
.push(AccountMeta(jane_pubkey, true));
doe_client.process_instruction(move_instruction).unwrap();
assert_eq!(bank.get_balance(&bob_pubkey), 42);

View File

@ -112,7 +112,7 @@ mod tests {
use solana_sdk::signature::{Keypair, KeypairUtil};
use solana_sdk::system_instruction::SystemInstruction;
use solana_sdk::system_program;
use solana_sdk::transaction::{Instruction, InstructionError, TransactionError};
use solana_sdk::transaction::{AccountMeta, Instruction, InstructionError, TransactionError};
#[test]
fn test_create_system_account() {
@ -291,10 +291,14 @@ mod tests {
// Erroneously sign transaction with recipient account key
// No signature case is tested by bank `test_zero_signatures()`
let account_metas = vec![
AccountMeta(alice_pubkey, false),
AccountMeta(mallory_pubkey, true),
];
let malicious_script = Script::new(vec![Instruction::new(
system_program::id(),
&SystemInstruction::Move { lamports: 10 },
vec![(alice_pubkey, false), (mallory_pubkey, true)],
account_metas,
)]);
assert_eq!(
mallory_client.process_script(malicious_script),