Move mock request_airdrop_transaction into drone/, closer to the real impl

This commit is contained in:
Michael Vines
2019-03-16 21:47:16 -07:00
parent e2c24481e4
commit 97e73311c5
4 changed files with 27 additions and 23 deletions

23
drone/src/drone_mock.rs Normal file
View File

@ -0,0 +1,23 @@
use solana_sdk::hash::Hash;
use solana_sdk::pubkey::Pubkey;
use solana_sdk::signature::{Keypair, KeypairUtil};
use solana_sdk::system_transaction::SystemTransaction;
use solana_sdk::transaction::Transaction;
use std::io::{Error, ErrorKind};
use std::net::SocketAddr;
pub fn request_airdrop_transaction(
_drone_addr: &SocketAddr,
_id: &Pubkey,
lamports: u64,
_blockhash: Hash,
) -> Result<Transaction, Error> {
if lamports == 0 {
Err(Error::new(ErrorKind::Other, "Airdrop failed"))?
}
let key = Keypair::new();
let to = Keypair::new().pubkey();
let blockhash = Hash::default();
let tx = SystemTransaction::new_account(&key, &to, lamports, blockhash, 0);
Ok(tx)
}

View File

@ -1 +1,2 @@
pub mod drone;
pub mod drone_mock;