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:
@@ -1377,7 +1377,7 @@ fn process_deploy(
|
||||
program_data.len() as u64,
|
||||
&bpf_loader::id(),
|
||||
);
|
||||
let message = Message::new(&[ix]);
|
||||
let message = Message::new(&[ix], Some(&config.signers[0].pubkey()));
|
||||
let mut create_account_tx = Transaction::new_unsigned(message);
|
||||
let signers = [config.signers[0], program_id];
|
||||
create_account_tx.try_sign(&signers, blockhash)?;
|
||||
@@ -1390,7 +1390,7 @@ fn process_deploy(
|
||||
(i * DATA_CHUNK_SIZE) as u32,
|
||||
chunk.to_vec(),
|
||||
);
|
||||
let message = Message::new_with_payer(&[instruction], Some(&signers[0].pubkey()));
|
||||
let message = Message::new(&[instruction], Some(&signers[0].pubkey()));
|
||||
let mut tx = Transaction::new_unsigned(message);
|
||||
tx.try_sign(&signers, blockhash)?;
|
||||
write_transactions.push(tx);
|
||||
@@ -1400,7 +1400,7 @@ fn process_deploy(
|
||||
}
|
||||
|
||||
let instruction = loader_instruction::finalize(&program_id.pubkey(), &bpf_loader::id());
|
||||
let message = Message::new_with_payer(&[instruction], Some(&signers[0].pubkey()));
|
||||
let message = Message::new(&[instruction], Some(&signers[0].pubkey()));
|
||||
let mut finalize_tx = Transaction::new_unsigned(message);
|
||||
finalize_tx.try_sign(&signers, blockhash)?;
|
||||
messages.push(&finalize_tx.message);
|
||||
@@ -1483,7 +1483,7 @@ fn process_pay(
|
||||
if let Some(nonce_account) = &nonce_account {
|
||||
Message::new_with_nonce(vec![ix], None, nonce_account, &nonce_authority.pubkey())
|
||||
} else {
|
||||
Message::new(&[ix])
|
||||
Message::new(&[ix], Some(&config.signers[0].pubkey()))
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1539,7 +1539,7 @@ fn process_pay(
|
||||
cancelable,
|
||||
lamports,
|
||||
);
|
||||
Message::new(&ixs)
|
||||
Message::new(&ixs, Some(&config.signers[0].pubkey()))
|
||||
};
|
||||
let (message, _) = resolve_spend_tx_and_check_account_balance(
|
||||
rpc_client,
|
||||
@@ -1590,7 +1590,7 @@ fn process_pay(
|
||||
cancelable,
|
||||
lamports,
|
||||
);
|
||||
Message::new(&ixs)
|
||||
Message::new(&ixs, Some(&config.signers[0].pubkey()))
|
||||
};
|
||||
let (message, _) = resolve_spend_tx_and_check_account_balance(
|
||||
rpc_client,
|
||||
@@ -1633,7 +1633,7 @@ fn process_cancel(rpc_client: &RpcClient, config: &CliConfig, pubkey: &Pubkey) -
|
||||
pubkey,
|
||||
&config.signers[0].pubkey(),
|
||||
);
|
||||
let message = Message::new(&[ix]);
|
||||
let message = Message::new(&[ix], Some(&config.signers[0].pubkey()));
|
||||
let mut tx = Transaction::new_unsigned(message);
|
||||
tx.try_sign(&config.signers, blockhash)?;
|
||||
check_account_for_fee_with_commitment(
|
||||
@@ -1663,7 +1663,7 @@ fn process_time_elapsed(
|
||||
.value;
|
||||
|
||||
let ix = budget_instruction::apply_timestamp(&config.signers[0].pubkey(), pubkey, to, dt);
|
||||
let message = Message::new(&[ix]);
|
||||
let message = Message::new(&[ix], Some(&config.signers[0].pubkey()));
|
||||
let mut tx = Transaction::new_unsigned(message);
|
||||
tx.try_sign(&config.signers, blockhash)?;
|
||||
check_account_for_fee_with_commitment(
|
||||
@@ -1714,7 +1714,7 @@ fn process_transfer(
|
||||
&nonce_authority.pubkey(),
|
||||
)
|
||||
} else {
|
||||
Message::new_with_payer(&ixs, Some(&fee_payer.pubkey()))
|
||||
Message::new(&ixs, Some(&fee_payer.pubkey()))
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1765,7 +1765,7 @@ fn process_witness(
|
||||
.value;
|
||||
|
||||
let ix = budget_instruction::apply_signature(&config.signers[0].pubkey(), pubkey, to);
|
||||
let message = Message::new(&[ix]);
|
||||
let message = Message::new(&[ix], Some(&config.signers[0].pubkey()));
|
||||
let mut tx = Transaction::new_unsigned(message);
|
||||
tx.try_sign(&config.signers, blockhash)?;
|
||||
check_account_for_fee_with_commitment(
|
||||
|
Reference in New Issue
Block a user