diff --git a/src/pow.cpp b/src/pow.cpp index 31c9eafcf..a63ac8d21 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -509,8 +509,9 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead } // Changing this requires changing many other things and -// changes consensus. Have fun -- Duke -int64_t AveragingWindowTimespan(int32_t height) { +// might change consensus. Have fun -- Duke +// NOTE: Ony HUSH3 mainnet should use this function, all HSC's should use params.AveragigWindowTimespan() +int64_t AveragingWindowTimespan() { // used in const methods, beware! // This is the correct AWT for 75s blocktime, before block 340k // the correct value was 2550 when the blocktime was 150s @@ -527,9 +528,9 @@ unsigned int CalculateNextWorkRequired(arith_uint256 bnAvg, int64_t nActualTimespan = nLastBlockTime - nFirstBlockTime; LogPrint("pow", " nActualTimespan = %d before dampening\n", nActualTimespan); - //NOTE: this will break HUSH+DRAGONX mainnet! For testing only. - int64_t AWT = params.AveragingWindowTimespan(); - //int64_t AWT = AveragingWindowTimespan(height) ; + bool ishush3 = strncmp(SMART_CHAIN_SYMBOL, "HUSH3",5) == 0 ? true : false; + // If this is HUSH3, use AWT function defined above, else use the one in params + int64_t AWT = ishush3 ? AveragingWindowTimespan() : params.AveragingWindowTimespan(); nActualTimespan = AWT + (nActualTimespan - AWT)/4; LogPrint("pow", " nActualTimespan = %d before bounds\n", nActualTimespan);