Add support for BPF program custom errors (#5743)

* Add support for BPF program custom errors

* Rename SOL_SUCCESS -> SUCCESS
This commit is contained in:
Justin Starry
2019-09-06 16:05:01 -07:00
committed by GitHub
parent d3052d094c
commit 81c36699c4
26 changed files with 108 additions and 67 deletions

View File

@ -2,10 +2,11 @@
extern crate solana_sdk;
use byteorder::{ByteOrder, LittleEndian};
use solana_sdk::entrypoint::SUCCESS;
use solana_sdk::info;
#[no_mangle]
pub extern "C" fn entrypoint(_input: *mut u8) -> bool {
pub extern "C" fn entrypoint(_input: *mut u8) -> u32 {
let mut buf = [0; 4];
LittleEndian::write_u32(&mut buf, 1_000_000);
assert_eq!(1_000_000, LittleEndian::read_u32(&buf));
@ -15,5 +16,5 @@ pub extern "C" fn entrypoint(_input: *mut u8) -> bool {
assert_eq!(-5_000, LittleEndian::read_i16(&buf));
info!("Success");
true
SUCCESS
}