Skip to content

Commit

Permalink
fix critical bug in matrix generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Dev committed Jun 28, 2024
1 parent a8405b3 commit 5dea9c1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion domain/consensus/utils/pow/pow.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func NewState(header externalapi.MutableBlockHeader, generatedag bool) *State {
Target: *target,
prePowHash: *prePowHash,
//will remove matrix opow
//mat: *generateMatrix(prePowHash),
mat: *generateMatrix(prePowHash),
Timestamp: timestamp,
Nonce: nonce,
context: *getContext(generatedag, log),
Expand Down Expand Up @@ -144,8 +144,10 @@ func (state *State) CalculateProofOfWorkValue() *big.Int {
//log.Infof("Hash b3-1: %x", powHash.ByteSlice())
finalHash := powHash
if state.blockVersion == constants.BlockVersionBeforeHF {
log.Infof("Using khashv1 %d %d\n", state.blockVersion, constants.BlockVersionBeforeHF)
finalHash = state.mat.HeavyHash(powHash)
} else {
log.Infof("Using khashv2 %d %d\n", state.blockVersion, constants.BlockVersionBeforeHF)
middleHash := fishHashPlus(&state.context, powHash)
writer2 := hashes.NewPoWHashWriter()
writer2.InfallibleWrite(middleHash.ByteSlice())
Expand Down
1 change: 1 addition & 0 deletions domain/dagconfig/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@ var DevnetParams = Params{

MaxBlockLevel: 250,
MergeDepth: defaultMergeDepth,
HFDAAScore: 50,
}

// ErrDuplicateNet describes an error where the parameters for a Karlsen
Expand Down

0 comments on commit 5dea9c1

Please sign in to comment.