3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-16 04:05:50 +00:00

Wallet: Fix getKeyRotationTime() to return null if unconfigured.

This commit is contained in:
Andreas Schildbach 2016-03-03 16:20:24 +01:00
parent be1b3f592d
commit 660f0b1b24

View File

@ -3165,8 +3165,8 @@ public class Wallet extends BaseTaggableObject
// Do the keys. // Do the keys.
builder.append("\nKeys:\n"); builder.append("\nKeys:\n");
final long keyRotationTime = vKeyRotationTimestamp * 1000; final Date keyRotationTime = getKeyRotationTime();
if (keyRotationTime > 0) if (keyRotationTime != null)
builder.append("Key rotation time: ").append(Utils.dateTimeFormat(keyRotationTime)).append('\n'); builder.append("Key rotation time: ").append(Utils.dateTimeFormat(keyRotationTime)).append('\n');
builder.append(keyChainGroup.toString(includePrivateKeys)); builder.append(keyChainGroup.toString(includePrivateKeys));
@ -5300,10 +5300,15 @@ public class Wallet extends BaseTaggableObject
} }
/** /**
* Returns a UNIX time since the epoch in seconds, or zero if unconfigured. * Returns the key rotation time, or null if unconfigured. See {@link #setKeyRotationTime(Date)} for a description
* of the field.
*/ */
public Date getKeyRotationTime() { public @Nullable Date getKeyRotationTime() {
return new Date(vKeyRotationTimestamp * 1000); final long keyRotationTimestamp = vKeyRotationTimestamp;
if (keyRotationTimestamp != 0)
return new Date(keyRotationTimestamp * 1000);
else
return null;
} }
/** /**