@ -483,6 +483,23 @@ impl StorageStage {
|
|||||||
slot,
|
slot,
|
||||||
instruction_sender,
|
instruction_sender,
|
||||||
)?;
|
)?;
|
||||||
|
Self::submit_verifications(
|
||||||
|
&storage_state,
|
||||||
|
&storage_keypair,
|
||||||
|
instruction_sender,
|
||||||
|
)?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn submit_verifications(
|
||||||
|
storage_state: &Arc<RwLock<StorageStateInner>>,
|
||||||
|
storage_keypair: &Arc<Keypair>,
|
||||||
|
ix_sender: &Sender<Instruction>,
|
||||||
|
) -> Result<()> {
|
||||||
// bundle up mining submissions from replicators
|
// bundle up mining submissions from replicators
|
||||||
// and submit them in a tx to the leader to get rewarded.
|
// and submit them in a tx to the leader to get rewarded.
|
||||||
let mut w_state = storage_state.write().unwrap();
|
let mut w_state = storage_state.write().unwrap();
|
||||||
@ -507,11 +524,8 @@ impl StorageStage {
|
|||||||
})
|
})
|
||||||
.collect::<HashMap<_, _>>();
|
.collect::<HashMap<_, _>>();
|
||||||
if !checked_proofs.is_empty() {
|
if !checked_proofs.is_empty() {
|
||||||
let ix = proof_validation(
|
let ix =
|
||||||
&storage_keypair.pubkey(),
|
proof_validation(&storage_keypair.pubkey(), segment as u64, checked_proofs);
|
||||||
segment as u64,
|
|
||||||
checked_proofs,
|
|
||||||
);
|
|
||||||
Some(ix)
|
Some(ix)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
@ -521,13 +535,9 @@ impl StorageStage {
|
|||||||
// TODO Avoid AccountInUse errors in this loop
|
// TODO Avoid AccountInUse errors in this loop
|
||||||
let res: std::result::Result<_, _> = instructions
|
let res: std::result::Result<_, _> = instructions
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|ix| instruction_sender.send(ix))
|
.map(|ix| ix_sender.send(ix))
|
||||||
.collect();
|
.collect();
|
||||||
res?
|
res?;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user