Don't drop transactions which use a request heap size ix (#25315)

This commit is contained in:
Justin Starry 2022-05-18 17:47:24 +08:00 committed by GitHub
parent a1522d0024
commit 5548baf4dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 4 deletions

View File

@ -373,9 +373,9 @@ fn get_priority(message: &SanitizedVersionedMessage) -> Option<u64> {
let prioritization_fee_details = compute_budget
.process_instructions(
message.program_instructions_iter(),
false, // not request heap size
true, // don't reject txs that use request heap size ix
true, // use default units per instruction
true, // use changed prioritization fee
true, // don't reject txs that use set compute unit price ix
)
.ok()?;
Some(prioritization_fee_details.get_priority())
@ -397,7 +397,10 @@ pub fn transactions_to_deserialized_packets(
mod tests {
use {
super::*,
solana_sdk::{signature::Keypair, system_transaction},
solana_sdk::{
compute_budget::ComputeBudgetInstruction, message::VersionedMessage, pubkey::Pubkey,
signature::Keypair, system_transaction,
},
std::net::IpAddr,
};
@ -524,4 +527,15 @@ mod tests {
assert!(unprocessed_packet_batches.is_empty());
assert!(unprocessed_packet_batches.pop_max_n(0).is_none());
}
#[test]
fn test_get_priority_with_valid_request_heap_frame_tx() {
let payer = Pubkey::new_unique();
let message = SanitizedVersionedMessage::try_from(VersionedMessage::Legacy(Message::new(
&[ComputeBudgetInstruction::request_heap_frame(32 * 1024)],
Some(&payer),
)))
.unwrap();
assert_eq!(get_priority(&message), Some(0));
}
}