Add handling for fallible signers (#8367)

automerge
This commit is contained in:
Tyera Eulberg
2020-02-20 20:04:53 -07:00
committed by GitHub
parent 18fd52367e
commit 0b7e8d0162
9 changed files with 181 additions and 83 deletions

View File

@ -36,7 +36,7 @@ use solana_sdk::{
native_token::lamports_to_sol,
program_utils::DecodeError,
pubkey::Pubkey,
signature::{keypair_from_seed, Keypair, Signature, Signer},
signature::{keypair_from_seed, Keypair, Signature, Signer, SignerError},
system_instruction::{self, create_address_with_seed, SystemError, MAX_ADDRESS_SEED_LEN},
system_transaction,
transaction::{Transaction, TransactionError},
@ -1980,7 +1980,7 @@ impl Signer for FaucetKeypair {
self.transaction.message().account_keys[0]
}
fn try_pubkey(&self) -> Result<Pubkey, Box<dyn error::Error>> {
fn try_pubkey(&self) -> Result<Pubkey, SignerError> {
Ok(self.pubkey())
}
@ -1988,7 +1988,7 @@ impl Signer for FaucetKeypair {
self.transaction.signatures[0]
}
fn try_sign_message(&self, message: &[u8]) -> Result<Signature, Box<dyn error::Error>> {
fn try_sign_message(&self, message: &[u8]) -> Result<Signature, SignerError> {
Ok(self.sign_message(message))
}
}