mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-11-02 05:27:17 +00:00
Block: Improve message of VerificationException that is thrown when a blocks time is too far in the future.
This commit is contained in:
@@ -557,10 +557,11 @@ public class Block extends Message {
|
||||
}
|
||||
|
||||
private void checkTimestamp() throws VerificationException {
|
||||
// Allow injection of a fake clock to allow unit testing.
|
||||
long currentTime = Utils.currentTimeSeconds();
|
||||
if (time > currentTime + ALLOWED_TIME_DRIFT)
|
||||
throw new VerificationException(String.format(Locale.US, "Block too far in future: %d vs %d", time, currentTime + ALLOWED_TIME_DRIFT));
|
||||
final long allowedTime = Utils.currentTimeSeconds() + ALLOWED_TIME_DRIFT;
|
||||
if (time > allowedTime)
|
||||
throw new VerificationException(String.format(Locale.US,
|
||||
"Block too far in future: %s (%d) vs allowed %s (%d)", Utils.dateTimeFormat(time * 1000), time,
|
||||
Utils.dateTimeFormat(allowedTime * 1000), allowedTime));
|
||||
}
|
||||
|
||||
private void checkSigOps() throws VerificationException {
|
||||
|
||||
Reference in New Issue
Block a user