diff --git a/node/consensus/data/main_data_loop.go b/node/consensus/data/main_data_loop.go index 27ec429..f8f9ba8 100644 --- a/node/consensus/data/main_data_loop.go +++ b/node/consensus/data/main_data_loop.go @@ -287,7 +287,6 @@ func (e *DataClockConsensusEngine) rebroadcastLoop() { e.logger.Info("shutting down rebroadcaster") return } - i++ frame, _, err := e.clockStore.GetDataClockFrame(e.filter, i, false) if err != nil { e.logger.Error("error while iterating", zap.Error(err)) diff --git a/node/consensus/data/peer_messaging.go b/node/consensus/data/peer_messaging.go index 1f38a5f..4c2c867 100644 --- a/node/consensus/data/peer_messaging.go +++ b/node/consensus/data/peer_messaging.go @@ -256,7 +256,9 @@ func (e *DataClockConsensusEngine) handleMint( return nil, errors.Wrap(application.ErrInvalidStateTransition, "handle mint") } if pre.Difficulty == 0 { - _, pr, err := e.coinStore.GetPreCoinProofsForOwner(t.Proofs[0][32:]) + _, pr, err := e.coinStore.GetPreCoinProofsForOwner( + altAddr.FillBytes(make([]byte, 32)), + ) if err != nil && !errors.Is(err, store.ErrNotFound) { return nil, errors.Wrap(application.ErrInvalidStateTransition, "handle mint") } diff --git a/node/consensus/data/pre_midnight_proof_worker.go b/node/consensus/data/pre_midnight_proof_worker.go index 9a93177..23e54e7 100644 --- a/node/consensus/data/pre_midnight_proof_worker.go +++ b/node/consensus/data/pre_midnight_proof_worker.go @@ -86,6 +86,17 @@ func (e *DataClockConsensusEngine) runPreMidnightProofWorker() { resume := make([]byte, 32) for { + _, prfs, err := e.coinStore.GetPreCoinProofsForOwner(addr) + if err != nil && !errors.Is(err, store.ErrNotFound) { + e.logger.Error("error while fetching pre-coin proofs", zap.Error(err)) + return + } + + if len(prfs) != 0 { + e.logger.Info("already completed pre-midnight mint") + return + } + cc, err := e.pubSub.GetDirectChannel([]byte(peerId), "worker") if err != nil { e.logger.Info( diff --git a/node/consensus/time/data_time_reel.go b/node/consensus/time/data_time_reel.go index e2fc197..6e380d1 100644 --- a/node/consensus/time/data_time_reel.go +++ b/node/consensus/time/data_time_reel.go @@ -521,10 +521,6 @@ func (d *DataTimeReel) processPending( lastSelector := lastReceived.selector for _, f := range frameNumbers { - if f < d.head.FrameNumber { - delete(d.pending, f) - } - if f == d.head.FrameNumber+1 { nextPending := d.pending[f] // d.logger.Debug(