Rename AdvertiseStorageLastId to AdvertiseStorageRecentBlockHash

This commit is contained in:
Michael Vines 2019-03-02 09:46:19 -08:00 committed by Greg Fitzgerald
parent 0743f54dfe
commit ea110efabd
3 changed files with 9 additions and 9 deletions

View File

@ -83,7 +83,7 @@ fn entrypoint(
}; };
storage_account_state.proofs[segment_index].push(proof_info); storage_account_state.proofs[segment_index].push(proof_info);
} }
StorageProgram::AdvertiseStorageLastId { id, entry_height } => { StorageProgram::AdvertiseStorageRecentBlockHash { hash, entry_height } => {
let original_segments = storage_account_state.entry_height / ENTRIES_PER_SEGMENT; let original_segments = storage_account_state.entry_height / ENTRIES_PER_SEGMENT;
let segments = entry_height / ENTRIES_PER_SEGMENT; let segments = entry_height / ENTRIES_PER_SEGMENT;
debug!( debug!(
@ -95,7 +95,7 @@ fn entrypoint(
} }
storage_account_state.entry_height = entry_height; storage_account_state.entry_height = entry_height;
storage_account_state.id = id; storage_account_state.hash = hash;
// move the proofs to previous_proofs // move the proofs to previous_proofs
storage_account_state.previous_proofs = storage_account_state.proofs.clone(); storage_account_state.previous_proofs = storage_account_state.proofs.clone();

View File

@ -30,7 +30,7 @@ fn get_storage_last_id(bank: &Bank, account: Pubkey) -> Hash {
let state = deserialize(&storage_system_account.userdata); let state = deserialize(&storage_system_account.userdata);
if let Ok(state) = state { if let Ok(state) = state {
let state: storage_program::StorageProgramState = state; let state: storage_program::StorageProgramState = state;
return state.id; return state.hash;
} }
} }
Hash::default() Hash::default()

View File

@ -32,7 +32,7 @@ pub struct ValidationInfo {
#[derive(Default, Debug, Serialize, Deserialize)] #[derive(Default, Debug, Serialize, Deserialize)]
pub struct StorageProgramState { pub struct StorageProgramState {
pub entry_height: u64, pub entry_height: u64,
pub id: Hash, pub hash: Hash,
pub proofs: Vec<Vec<ProofInfo>>, pub proofs: Vec<Vec<ProofInfo>>,
pub previous_proofs: Vec<Vec<ProofInfo>>, pub previous_proofs: Vec<Vec<ProofInfo>>,
@ -48,8 +48,8 @@ pub enum StorageProgram {
entry_height: u64, entry_height: u64,
signature: Signature, signature: Signature,
}, },
AdvertiseStorageLastId { AdvertiseStorageRecentBlockHash {
id: Hash, hash: Hash,
entry_height: u64, entry_height: u64,
}, },
ClaimStorageReward { ClaimStorageReward {
@ -94,12 +94,12 @@ impl StorageTransaction {
pub fn new_advertise_recent_block_hash( pub fn new_advertise_recent_block_hash(
from_keypair: &Keypair, from_keypair: &Keypair,
storage_id: Hash, storage_hash: Hash,
recent_block_hash: Hash, recent_block_hash: Hash,
entry_height: u64, entry_height: u64,
) -> Transaction { ) -> Transaction {
let program = StorageProgram::AdvertiseStorageLastId { let program = StorageProgram::AdvertiseStorageRecentBlockHash {
id: storage_id, hash: storage_hash,
entry_height, entry_height,
}; };
Transaction::new(from_keypair, &[], id(), &program, recent_block_hash, 0) Transaction::new(from_keypair, &[], id(), &program, recent_block_hash, 0)