Add separate Struct for Replicator submissions

This commit is contained in:
Sagar Dhawan
2019-04-03 15:51:05 -07:00
committed by Grimes
parent 00cb52c444
commit b441bac7b2
3 changed files with 36 additions and 48 deletions

View File

@@ -1,5 +1,5 @@
use crate::id;
use crate::storage_contract::ProofInfo;
use crate::storage_contract::CheckedProof;
use serde_derive::{Deserialize, Serialize};
use solana_sdk::hash::Hash;
use solana_sdk::instruction::{AccountMeta, Instruction};
@@ -23,7 +23,7 @@ pub enum StorageInstruction {
},
ProofValidation {
entry_height: u64,
proofs: Vec<ProofInfo>,
proofs: Vec<CheckedProof>,
},
}
@@ -58,12 +58,12 @@ pub fn advertise_recent_blockhash(
pub fn proof_validation(
from_pubkey: &Pubkey,
entry_height: u64,
proofs: Vec<ProofInfo>,
proofs: Vec<CheckedProof>,
) -> Instruction {
let mut account_metas = vec![AccountMeta::new(*from_pubkey, true)];
proofs
.iter()
.for_each(|proof| account_metas.push(AccountMeta::new(proof.id, false)));
proofs.iter().for_each(|checked_proof| {
account_metas.push(AccountMeta::new(checked_proof.proof.id, false))
});
let storage_instruction = StorageInstruction::ProofValidation {
entry_height,
proofs,