Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Commit

Permalink
program-test: Add ProgramTestContext::get_new_latest_blockhash (#28977
Browse files Browse the repository at this point in the history
)
  • Loading branch information
joncinque authored Nov 29, 2022
1 parent fd13323 commit 99d8929
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions program-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

0 comments on commit 99d8929

Please sign in to comment.