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:
@@ -125,9 +125,10 @@ impl Faucet {
|
||||
);
|
||||
info!("Requesting airdrop of {} to {:?}", lamports, to);
|
||||
|
||||
let mint_pubkey = self.mint_keypair.pubkey();
|
||||
let create_instruction =
|
||||
system_instruction::transfer(&self.mint_keypair.pubkey(), &to, lamports);
|
||||
let message = Message::new(&[create_instruction]);
|
||||
system_instruction::transfer(&mint_pubkey, &to, lamports);
|
||||
let message = Message::new(&[create_instruction], Some(&mint_pubkey));
|
||||
Ok(Transaction::new(&[&self.mint_keypair], message, blockhash))
|
||||
} else {
|
||||
Err(Error::new(
|
||||
@@ -413,7 +414,7 @@ mod tests {
|
||||
|
||||
let keypair = Keypair::new();
|
||||
let expected_instruction = system_instruction::transfer(&keypair.pubkey(), &to, lamports);
|
||||
let message = Message::new(&[expected_instruction]);
|
||||
let message = Message::new(&[expected_instruction], Some(&keypair.pubkey()));
|
||||
let expected_tx = Transaction::new(&[&keypair], message, blockhash);
|
||||
let expected_bytes = serialize(&expected_tx).unwrap();
|
||||
let mut expected_vec_with_length = vec![0; 2];
|
||||
|
@@ -16,7 +16,7 @@ fn test_local_faucet() {
|
||||
let lamports = 50;
|
||||
let blockhash = Hash::new(&to.as_ref());
|
||||
let create_instruction = system_instruction::transfer(&keypair.pubkey(), &to, lamports);
|
||||
let message = Message::new(&[create_instruction]);
|
||||
let message = Message::new(&[create_instruction], Some(&keypair.pubkey()));
|
||||
let expected_tx = Transaction::new(&[&keypair], message, blockhash);
|
||||
|
||||
let (sender, receiver) = channel();
|
||||
|
Reference in New Issue
Block a user