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

@@ -4,7 +4,7 @@ use crate::{
hash::Hash,
instruction::{AccountMeta, CompiledInstruction, Instruction},
pubkey::Pubkey,
short_vec,
short_vec, system_instruction,
};
use itertools::Itertools;
@@ -208,6 +208,20 @@ impl Message {
)
}
pub fn new_with_nonce(
mut instructions: Vec<Instruction>,
payer: Option<&Pubkey>,
nonce_account_pubkey: &Pubkey,
nonce_authority_pubkey: &Pubkey,
) -> Self {
let nonce_ix = system_instruction::advance_nonce_account(
&nonce_account_pubkey,
&nonce_authority_pubkey,
);
instructions.insert(0, nonce_ix);
Self::new_with_payer(instructions, payer)
}
pub fn serialize(&self) -> Vec<u8> {
bincode::serialize(self).unwrap()
}