Fixes the empty transaction bug in ThisInvokeContext::push() and adds a test for it to the bank.
This commit is contained in:
committed by
GitHub
parent
0bda0c3e0c
commit
8a50b6302f
@ -15391,4 +15391,18 @@ pub(crate) mod tests {
|
||||
.unwrap();
|
||||
assert_eq!(Bank::calculate_fee(&message, 1), 11);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_an_empty_transaction_without_program() {
|
||||
let (genesis_config, mint_keypair) = create_genesis_config(1);
|
||||
let bank = Bank::new_for_tests(&genesis_config);
|
||||
|
||||
let destination = solana_sdk::pubkey::new_rand();
|
||||
let mut ix = system_instruction::transfer(&mint_keypair.pubkey(), &destination, 0);
|
||||
ix.program_id = native_loader::id(); // Empty executable account chain
|
||||
|
||||
let message = Message::new(&[ix], Some(&mint_keypair.pubkey()));
|
||||
let tx = Transaction::new(&[&mint_keypair], message, genesis_config.hash());
|
||||
bank.process_transaction(&tx).unwrap();
|
||||
}
|
||||
}
|
||||
|
@ -17,8 +17,6 @@ fn process_instruction_with_program_logging(
|
||||
instruction_data: &[u8],
|
||||
invoke_context: &mut dyn InvokeContext,
|
||||
) -> Result<(), InstructionError> {
|
||||
debug_assert_eq!(first_instruction_account, 1);
|
||||
|
||||
let logger = invoke_context.get_logger();
|
||||
let program_id = invoke_context.get_caller()?;
|
||||
stable_log::program_invoke(&logger, program_id, invoke_context.invoke_depth());
|
||||
|
Reference in New Issue
Block a user