From c87fbddf2f75f3f389ff5a4f9ff2f03313c44e98 Mon Sep 17 00:00:00 2001 From: Elichai Turkel Date: Sat, 6 Nov 2021 21:46:25 +0200 Subject: [PATCH] Replace our current PoW algorithm with oPoW --- domain/consensus/utils/pow/pow.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/domain/consensus/utils/pow/pow.go b/domain/consensus/utils/pow/pow.go index ca59c1aff..d77633616 100644 --- a/domain/consensus/utils/pow/pow.go +++ b/domain/consensus/utils/pow/pow.go @@ -52,7 +52,10 @@ func CalculateProofOfWorkValue(header externalapi.MutableBlockHeader) *big.Int { if err != nil { panic(errors.Wrap(err, "this should never happen. Hash digest should never return an error")) } - return toBig(writer.Finalize()) + powHash := writer.Finalize() + matrix := generateMatrix(powHash) + heavyHash := matrix.HeavyHash(powHash) + return toBig(heavyHash) } // ToBig converts a externalapi.DomainHash into a big.Int treated as a little endian string.