Files
solana/perf/src/test_tx.rs

43 lines
1.1 KiB
Rust
Raw Normal View History

use solana_sdk::{
hash::Hash,
instruction::CompiledInstruction,
signature::{Keypair, Signer},
stake,
system_instruction::SystemInstruction,
system_program, system_transaction,
transaction::Transaction,
};
2018-12-04 15:37:11 -08:00
pub fn test_tx() -> Transaction {
let keypair1 = Keypair::new();
let pubkey1 = keypair1.pubkey();
let zero = Hash::default();
system_transaction::transfer(&keypair1, &pubkey1, 42, zero)
2018-12-04 15:37:11 -08:00
}
2019-03-28 19:11:16 -06:00
pub fn test_multisig_tx() -> Transaction {
let keypair0 = Keypair::new();
let keypair1 = Keypair::new();
let keypairs = vec![&keypair0, &keypair1];
let lamports = 5;
let blockhash = Hash::default();
let transfer_instruction = SystemInstruction::Transfer { lamports };
2019-03-28 19:11:16 -06:00
let program_ids = vec![system_program::id(), stake::program::id()];
2019-03-28 19:11:16 -06:00
let instructions = vec![CompiledInstruction::new(
0,
&transfer_instruction,
vec![0, 1],
)];
2019-03-28 19:11:16 -06:00
Transaction::new_with_compiled_instructions(
&keypairs,
&[],
blockhash,
program_ids,
instructions,
)
}