Use Slot and Epoch type aliases instead of raw u64 (#6693)

automerge
This commit is contained in:
Michael Vines
2019-11-02 00:38:30 -07:00
committed by Grimes
parent f9a9b7f610
commit 50a17fc00b
41 changed files with 583 additions and 473 deletions

View File

@@ -2,14 +2,16 @@ use crate::storage_instruction::StorageAccountType;
use log::*;
use num_derive::FromPrimitive;
use serde_derive::{Deserialize, Serialize};
use solana_sdk::account::Account;
use solana_sdk::account::KeyedAccount;
use solana_sdk::account_utils::State;
use solana_sdk::hash::Hash;
use solana_sdk::instruction::InstructionError;
use solana_sdk::pubkey::Pubkey;
use solana_sdk::signature::Signature;
use solana_sdk::sysvar;
use solana_sdk::{
account::{Account, KeyedAccount},
account_utils::State,
clock::Epoch,
hash::Hash,
instruction::InstructionError,
pubkey::Pubkey,
signature::Signature,
sysvar,
};
use std::collections::BTreeMap;
// Todo Tune this for actual use cases when PoRep is feature complete
@@ -19,15 +21,15 @@ pub const MAX_PROOFS_PER_SEGMENT: usize = 80;
#[derive(Default, Debug, Serialize, Deserialize, Clone, PartialEq)]
pub struct Credits {
// current epoch
epoch: u64,
epoch: Epoch,
// currently pending credits
pub current_epoch: u64,
pub current_epoch: Epoch,
// credits ready to be claimed
pub redeemable: u64,
}
impl Credits {
pub fn update_epoch(&mut self, current_epoch: u64) {
pub fn update_epoch(&mut self, current_epoch: Epoch) {
if self.epoch != current_epoch {
self.epoch = current_epoch;
self.redeemable += self.current_epoch;