Expose tick_height to native programs

This commit is contained in:
Michael Vines
2018-11-13 18:18:40 -08:00
parent 0bf2ff6138
commit 5a8938209b
7 changed files with 18 additions and 15 deletions

View File

@ -5,7 +5,8 @@ pub const ENTRYPOINT: &str = "process";
// Native program ENTRYPOINT prototype
pub type Entrypoint =
unsafe extern "C" fn(keyed_accounts: &mut [KeyedAccount], data: &[u8]) -> bool;
unsafe extern "C" fn(keyed_accounts: &mut [KeyedAccount], data: &[u8], tick_height: u64)
-> bool;
// Convenience macro to define the native program entrypoint. Supply a fn to this macro that
// conforms to the `Entrypoint` type signature.
@ -13,8 +14,8 @@ pub type Entrypoint =
macro_rules! solana_entrypoint(
($entrypoint:ident) => (
#[no_mangle]
pub extern "C" fn process(keyed_accounts: &mut [KeyedAccount], data: &[u8]) -> bool {
return $entrypoint(keyed_accounts, data);
pub extern "C" fn process(keyed_accounts: &mut [KeyedAccount], data: &[u8], tick_height: u64) -> bool {
return $entrypoint(keyed_accounts, data, tick_height);
}
)
);