Add a constructor to generate random pubkeys

This commit is contained in:
Greg Fitzgerald
2019-03-30 21:37:33 -06:00
parent 32683cac7c
commit fcef54d062
51 changed files with 263 additions and 298 deletions

View File

@ -339,7 +339,7 @@ mod tests {
#[test]
fn test_drone_build_airdrop_transaction() {
let to = Keypair::new().pubkey();
let to = Pubkey::new_rand();
let blockhash = Hash::default();
let request = DroneRequest::GetAirdrop {
lamports: 2,
@ -377,7 +377,7 @@ mod tests {
#[test]
fn test_process_drone_request() {
let to = Keypair::new().pubkey();
let to = Pubkey::new_rand();
let blockhash = Hash::new(&to.as_ref());
let lamports = 50;
let req = DroneRequest::GetAirdrop {

View File

@ -16,7 +16,7 @@ pub fn request_airdrop_transaction(
Err(Error::new(ErrorKind::Other, "Airdrop failed"))?
}
let key = Keypair::new();
let to = Keypair::new().pubkey();
let to = Pubkey::new_rand();
let blockhash = Hash::default();
let tx = SystemTransaction::new_account(&key, &to, lamports, blockhash, 0);
Ok(tx)

View File

@ -1,6 +1,7 @@
use solana_drone::drone::{request_airdrop_transaction, run_local_drone};
use solana_sdk::hash::Hash;
use solana_sdk::message::Message;
use solana_sdk::pubkey::Pubkey;
use solana_sdk::signature::{Keypair, KeypairUtil};
use solana_sdk::system_instruction::SystemInstruction;
use solana_sdk::transaction::Transaction;
@ -9,7 +10,7 @@ use std::sync::mpsc::channel;
#[test]
fn test_local_drone() {
let keypair = Keypair::new();
let to = Keypair::new().pubkey();
let to = Pubkey::new_rand();
let lamports = 50;
let blockhash = Hash::new(&to.as_ref());
let create_instruction = SystemInstruction::new_account(&keypair.pubkey(), &to, lamports);