BPF rust language updates (#4752)

This commit is contained in:
Jack May
2019-06-20 16:07:12 -07:00
committed by GitHub
parent aacb38864c
commit e59b53dfa8
21 changed files with 230 additions and 180 deletions

View File

@@ -6,22 +6,14 @@
extern crate solana_sdk_bpf_utils;
use byteorder::{ByteOrder, LittleEndian};
use solana_sdk_bpf_utils::entrypoint;
use solana_sdk_bpf_utils::entrypoint::*;
use solana_sdk_bpf_utils::log::*;
use solana_sdk_bpf_utils::{entrypoint, info};
entrypoint!(process_instruction);
fn process_instruction(
ka: &mut [Option<SolKeyedAccount>; MAX_ACCOUNTS],
_info: &SolClusterInfo,
_data: &[u8],
) -> bool {
sol_log("Tick Height:");
if let Some(k) = &ka[2] {
let tick_height = LittleEndian::read_u64(k.data);
assert_eq!(10u64, tick_height);
sol_log("Success");
return true;
}
panic!();
fn process_instruction(ka: &mut [SolKeyedAccount], _info: &SolClusterInfo, _data: &[u8]) -> bool {
let tick_height = LittleEndian::read_u64(ka[2].data);
assert_eq!(10u64, tick_height);
info!("Success");
true
}