From c6879f5a66e2b5e514addbb65dcb6cb246d9a3f9 Mon Sep 17 00:00:00 2001 From: David Date: Thu, 18 Apr 2024 16:28:34 +0800 Subject: [PATCH] feat: update sender.Send --- prover/proof_submitter/transaction/sender.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/prover/proof_submitter/transaction/sender.go b/prover/proof_submitter/transaction/sender.go index d42ad45b5..eac51e58d 100644 --- a/prover/proof_submitter/transaction/sender.go +++ b/prover/proof_submitter/transaction/sender.go @@ -2,6 +2,7 @@ package transaction import ( "context" + "fmt" "math/big" "strings" @@ -41,6 +42,15 @@ func (s *Sender) Send( proofWithHeader *producer.ProofWithHeader, buildTx TxBuilder, ) error { + // Check if we still need to generate a new proof for that block. + proofStatus, err := rpc.GetBlockProofStatus(ctx, s.rpc, proofWithHeader.BlockID, proofWithHeader.Opts.ProverAddress) + if err != nil { + return err + } + if proofStatus.IsSubmitted { + return fmt.Errorf("proof for block %d is already submitted", proofWithHeader.BlockID) + } + // Check if this proof is still needed to be submitted. ok, err := s.validateProof(ctx, proofWithHeader) if err != nil || !ok {