Remove fee-payer guesswork from Message and Transaction (#10776)

* Make Message::new_with_payer the default constructor

* Remove Transaction::new_[un]signed_instructions

These guess the fee-payer instead of stating it explicitly
This commit is contained in:
Greg Fitzgerald
2020-06-24 14:52:38 -06:00
committed by GitHub
parent d5d5ad0071
commit 1c498369b5
47 changed files with 516 additions and 497 deletions

View File

@ -5225,7 +5225,7 @@ pub mod tests {
timestamp,
};
let vote_ix = vote_instruction::vote(&keypair.pubkey(), &keypair.pubkey(), vote);
let vote_msg = Message::new_with_payer(&[vote_ix], Some(&keypair.pubkey()));
let vote_msg = Message::new(&[vote_ix], Some(&keypair.pubkey()));
let vote_tx = Transaction::new(&[keypair], vote_msg, Hash::default());
vote_entries.push(next_entry_mut(&mut Hash::default(), 0, vec![vote_tx]));

View File

@ -677,6 +677,7 @@ mod tests {
use solana_budget_program::budget_instruction;
use solana_sdk::{
hash::{hash, Hash},
message::Message,
signature::{Keypair, Signer},
system_transaction,
transaction::Transaction,
@ -687,19 +688,22 @@ mod tests {
let budget_contract = Keypair::new();
let budget_pubkey = budget_contract.pubkey();
let ixs = budget_instruction::payment(&pubkey, &pubkey, &budget_pubkey, 1);
Transaction::new_signed_instructions(&[keypair, &budget_contract], &ixs, hash)
let message = Message::new(&ixs, Some(&pubkey));
Transaction::new(&[keypair, &budget_contract], message, hash)
}
fn create_sample_timestamp(keypair: &Keypair, hash: Hash) -> Transaction {
let pubkey = keypair.pubkey();
let ix = budget_instruction::apply_timestamp(&pubkey, &pubkey, &pubkey, Utc::now());
Transaction::new_signed_instructions(&[keypair], &[ix], hash)
let message = Message::new(&[ix], Some(&pubkey));
Transaction::new(&[keypair], message, hash)
}
fn create_sample_apply_signature(keypair: &Keypair, hash: Hash) -> Transaction {
let pubkey = keypair.pubkey();
let ix = budget_instruction::apply_signature(&pubkey, &pubkey, &pubkey);
Transaction::new_signed_instructions(&[keypair], &[ix], hash)
let message = Message::new(&[ix], Some(&pubkey));
Transaction::new(&[keypair], message, hash)
}
#[test]