program log pubkey as base58 (bp #12901) (#12911)

* program log pubkey as base58 (#12901)

(cherry picked from commit 3f9e6a600b)

# Conflicts:
#	programs/bpf/benches/bpf_loader.rs
#	programs/bpf/c/src/tuner/tuner.c

* resolve conflicts

* fix bench conflict

Co-authored-by: Jack May <jack@solana.com>
This commit is contained in:
mergify[bot]
2020-10-15 19:40:20 +00:00
committed by GitHub
parent e8c86ed3e5
commit 3df811348f
9 changed files with 139 additions and 30 deletions

View File

@@ -202,9 +202,16 @@ impl Pubkey {
pub fn to_bytes(self) -> [u8; 32] {
self.0
}
}
// TODO localalize this
/// Log a `Pubkey` from a program
#[cfg(feature = "program")]
pub fn log(&self) {
extern "C" {
fn sol_log_pubkey(pubkey_addr: *const u8);
};
unsafe { sol_log_pubkey(self.as_ref() as *const _ as *const u8) };
}
}
impl AsRef<[u8]> for Pubkey {
fn as_ref(&self) -> &[u8] {