Rename Bank.last_id() to Bank.last_block_hash()

This commit is contained in:
Michael Vines
2019-03-02 10:05:31 -08:00
committed by Greg Fitzgerald
parent 95cbb8a5c0
commit 2bfad87a5f
18 changed files with 86 additions and 86 deletions

View File

@ -25,14 +25,14 @@ fn bench_process_transaction(bencher: &mut Bencher) {
&mint_keypair,
rando0.pubkey(),
10_000,
bank.last_id(),
bank.last_block_hash(),
0,
);
assert_eq!(bank.process_transaction(&tx), Ok(()));
// Seed the 'to' account and a cell for its signature.
let rando1 = Keypair::new();
let tx = SystemTransaction::new_move(&rando0, rando1.pubkey(), 1, bank.last_id(), 0);
let tx = SystemTransaction::new_move(&rando0, rando1.pubkey(), 1, bank.last_block_hash(), 0);
assert_eq!(bank.process_transaction(&tx), Ok(()));
// Finally, return the transaction to the benchmark.
@ -40,7 +40,7 @@ fn bench_process_transaction(bencher: &mut Bencher) {
})
.collect();
let mut id = bank.last_id();
let mut id = bank.last_block_hash();
for _ in 0..(MAX_RECENT_TICK_HASHES - 1) {
bank.register_tick(&id);

View File

@ -298,7 +298,7 @@ impl Bank {
}
/// Return the last block hash registered.
pub fn last_id(&self) -> Hash {
pub fn last_block_hash(&self) -> Hash {
self.block_hash_queue.read().unwrap().last_hash()
}
@ -881,7 +881,7 @@ mod tests {
let (genesis_block, mint_keypair) = GenesisBlock::new(10_000);
let pubkey = Keypair::new().pubkey();
let bank = Bank::new(&genesis_block);
assert_eq!(bank.last_id(), genesis_block.hash());
assert_eq!(bank.last_block_hash(), genesis_block.hash());
bank.transfer(1_000, &mint_keypair, pubkey, genesis_block.hash())
.unwrap();
@ -899,7 +899,7 @@ mod tests {
let key1 = Keypair::new().pubkey();
let key2 = Keypair::new().pubkey();
let bank = Bank::new(&genesis_block);
assert_eq!(bank.last_id(), genesis_block.hash());
assert_eq!(bank.last_block_hash(), genesis_block.hash());
let t1 = SystemTransaction::new_move(&mint_keypair, key1, 1, genesis_block.hash(), 0);
let t2 = SystemTransaction::new_move(&mint_keypair, key2, 1, genesis_block.hash(), 0);
@ -1394,11 +1394,11 @@ mod tests {
let pubkey = Keypair::new().pubkey();
bank0
.transfer(1_000, &mint_keypair, pubkey, bank0.last_id())
.transfer(1_000, &mint_keypair, pubkey, bank0.last_block_hash())
.unwrap();
assert_ne!(bank0.hash_internal_state(), initial_state);
bank1
.transfer(1_000, &mint_keypair, pubkey, bank1.last_id())
.transfer(1_000, &mint_keypair, pubkey, bank1.last_block_hash())
.unwrap();
assert_eq!(bank0.hash_internal_state(), bank1.hash_internal_state());