currentSolidificationTime=time.Now().UnixNano()-message.IssuingTime().UnixNano()//We calculate the message solidication time?
powIncrement:=int(deltat/600000)
deltat:=currentSolidificationTime-prevSolidificationTime// deltat tracks the evolution of solidification time (if it increases, deltat is positive, negative if decrease). Unit is nanoseconds
powIncrement:=int(deltat/600000)//We use this time difference to directly calculate the PoW (if it increases, POW difficulty increases)
// If/else block to cap the PoW difficulty between 1 & 10.
ifdifficulty+powIncrement>10{
ifdifficulty+powIncrement>10{
return10
return10
}elseifdifficulty+powIncrement<1{
}elseifdifficulty+powIncrement<1{
return1
return1
}
}
// We return current difficulty (global variable) plus the increment calculated previously (positive if solidication time increases, negative otherwise).