Storage stage updates

* Remove logging init from storage program: saw a crash in a test
  indicating the logger being init'ed twice.
* Add entry_height mining proof to indicate which segment the result is
  for
* Add an interface to get storage miner pubkeys for a given entry_height
* Add an interface to get the current storage mining entry_height
* Set the tvu socket to 0.0.0.0:0 in replicator to stop getting entries
  after the desired ledger segment is downloaded.
* Use signature of PoH height to determine which block to download for
  replicator.
This commit is contained in:
Stephen Akridge
2018-12-10 11:38:29 -08:00
committed by sakridge
parent 3ce3f1adc1
commit 7cdbbfa88e
12 changed files with 287 additions and 86 deletions

View File

@ -5,7 +5,7 @@ use transaction::Transaction;
#[derive(Serialize, Deserialize, Debug, Clone)]
pub enum StorageProgram {
SubmitMiningProof { sha_state: Hash },
SubmitMiningProof { sha_state: Hash, entry_height: u64 },
}
pub const STORAGE_PROGRAM_ID: [u8; 32] = [
@ -22,12 +22,25 @@ pub fn id() -> Pubkey {
}
pub trait StorageTransaction {
fn storage_new_mining_proof(from_keypair: &Keypair, sha_state: Hash, last_id: Hash) -> Self;
fn storage_new_mining_proof(
from_keypair: &Keypair,
sha_state: Hash,
last_id: Hash,
entry_height: u64,
) -> Self;
}
impl StorageTransaction for Transaction {
fn storage_new_mining_proof(from_keypair: &Keypair, sha_state: Hash, last_id: Hash) -> Self {
let program = StorageProgram::SubmitMiningProof { sha_state };
fn storage_new_mining_proof(
from_keypair: &Keypair,
sha_state: Hash,
last_id: Hash,
entry_height: u64,
) -> Self {
let program = StorageProgram::SubmitMiningProof {
sha_state,
entry_height,
};
Transaction::new(
from_keypair,
&[from_keypair.pubkey()],