@laanwj If GetBlockValue returns > 2^64/1000, yours overflows undetectably. I think @il--ya 's is sound, though.