Add a flag to simulateTransaction to use most recent blockhash

This commit is contained in:
Justin Starry
2021-05-25 13:01:21 -07:00
committed by Michael Vines
parent 4eb6deee2d
commit 96cef5260c
3 changed files with 7 additions and 1 deletions

View File

@ -2969,7 +2969,7 @@ pub mod rpc_full {
debug!("simulate_transaction rpc request received");
let config = config.unwrap_or_default();
let encoding = config.encoding.unwrap_or(UiTransactionEncoding::Base58);
let (_, transaction) = deserialize_transaction(data, encoding)?;
let (_, mut transaction) = deserialize_transaction(data, encoding)?;
if config.sig_verify {
if let Err(e) = verify_transaction(&transaction) {
@ -2978,6 +2978,9 @@ pub mod rpc_full {
}
let bank = &*meta.bank(config.commitment);
if config.use_most_recent_blockhash {
transaction.message.recent_blockhash = bank.last_blockhash();
}
let (result, logs) = bank.simulate_transaction(transaction);
Ok(new_response(