Skip to content

Commit

Permalink
fix previous block proof saving
Browse files Browse the repository at this point in the history
  • Loading branch information
AdoAdoAdo committed Jan 30, 2025
1 parent 212798e commit 61edf71
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import (
"github.com/multiversx/mx-chain-core-go/core"
"github.com/multiversx/mx-chain-core-go/core/check"
"github.com/multiversx/mx-chain-core-go/data"
"github.com/multiversx/mx-chain-go/storage"
"github.com/multiversx/mx-chain-vm-v1_2-go/ipc/marshaling"

"github.com/multiversx/mx-chain-go/storage"
)

// IsValidRelayedTxV3 returns true if the provided transaction is a valid transaction of type relayed v3
Expand Down
5 changes: 4 additions & 1 deletion consensus/spos/bls/v2/subroundBlock.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,10 @@ func (sr *subroundBlock) createHeader() (data.HeaderHandler, error) {
}

func (sr *subroundBlock) saveProofForPreviousHeaderIfNeeded(header data.HeaderHandler, prevHeader data.HeaderHandler) {
if !common.ShouldBlockHavePrevProof(header, sr.EnableEpochsHandler(), common.EquivalentMessagesFlag) {
return
}

hasProof := sr.EquivalentProofsPool().HasProof(sr.ShardCoordinator().SelfId(), header.GetPrevHash())
if hasProof {
log.Debug("saveProofForPreviousHeaderIfNeeded: no need to set proof since it is already saved")
Expand Down Expand Up @@ -526,7 +530,6 @@ func (sr *subroundBlock) receivedBlockHeader(headerHandler data.HeaderHandler) {

sr.SetData(sr.Hasher().Compute(string(marshalledHeader)))
sr.SetHeader(headerHandler)

sr.saveProofForPreviousHeaderIfNeeded(headerHandler, prevHeader)

log.Debug("step 1: block header has been received",
Expand Down

0 comments on commit 61edf71

Please sign in to comment.