program-test: Add `ProgramTestContext::get_new_latest_blockhash` (#28977)

This commit is contained in:
Jon Cinque 2022-11-29 22:38:01 +01:00 committed by GitHub
parent fd13323f4b
commit 99d8929ab4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View File

@ -1180,4 +1180,14 @@ impl ProgramTestContext {
self.last_blockhash = bank.last_blockhash();
Ok(())
}
/// Get a new latest blockhash, similar in spirit to RpcClient::get_latest_blockhash()
pub async fn get_new_latest_blockhash(&mut self) -> io::Result<Hash> {
let blockhash = self
.banks_client
.get_new_latest_blockhash(&self.last_blockhash)
.await?;
self.last_blockhash = blockhash;
Ok(blockhash)
}
}