mirror of
https://github.com/tig-pool-nk/tig-monorepo.git
synced 2026-03-10 08:07:21 +08:00
Reject algorithm submissions for inactive challenges.
This commit is contained in:
parent
c074e4c26f
commit
6064ad2822
@ -25,11 +25,15 @@ async fn verify_challenge_exists<T: Context>(
|
||||
ctx: &T,
|
||||
details: &AlgorithmDetails,
|
||||
) -> ProtocolResult<()> {
|
||||
if ctx
|
||||
.get_challenges(ChallengesFilter::Id(details.challenge_id.clone()), None)
|
||||
let latest_block = ctx
|
||||
.get_block(BlockFilter::Latest, false)
|
||||
.await
|
||||
.unwrap_or_else(|e| panic!("get_challenges error: {:?}", e))
|
||||
.is_empty()
|
||||
.unwrap_or_else(|e| panic!("get_block error: {:?}", e))
|
||||
.expect("Expecting latest block to exist");
|
||||
if !latest_block
|
||||
.data()
|
||||
.active_challenge_ids
|
||||
.contains(&details.challenge_id)
|
||||
{
|
||||
return Err(ProtocolError::InvalidChallenge {
|
||||
challenge_id: details.challenge_id.clone(),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user