Route program_id to program entrypoint
This commit is contained in:
@ -1,12 +1,16 @@
|
||||
use account::KeyedAccount;
|
||||
use pubkey::Pubkey;
|
||||
|
||||
// All native programs export a symbol named process()
|
||||
pub const ENTRYPOINT: &str = "process";
|
||||
|
||||
// Native program ENTRYPOINT prototype
|
||||
pub type Entrypoint =
|
||||
unsafe extern "C" fn(keyed_accounts: &mut [KeyedAccount], data: &[u8], tick_height: u64)
|
||||
-> bool;
|
||||
pub type Entrypoint = unsafe extern "C" fn(
|
||||
program_id: &Pubkey,
|
||||
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.
|
||||
@ -14,8 +18,13 @@ pub type Entrypoint =
|
||||
macro_rules! solana_entrypoint(
|
||||
($entrypoint:ident) => (
|
||||
#[no_mangle]
|
||||
pub extern "C" fn process(keyed_accounts: &mut [KeyedAccount], data: &[u8], tick_height: u64) -> bool {
|
||||
return $entrypoint(keyed_accounts, data, tick_height);
|
||||
pub extern "C" fn process(
|
||||
program_id: &Pubkey,
|
||||
keyed_accounts: &mut [KeyedAccount],
|
||||
data: &[u8],
|
||||
tick_height: u64
|
||||
) -> bool {
|
||||
return $entrypoint(program_id, keyed_accounts, data, tick_height);
|
||||
}
|
||||
)
|
||||
);
|
||||
|
Reference in New Issue
Block a user