本文整理汇总了Java中org.bitcoinj.core.ECKey.getCreationTimeSeconds方法的典型用法代码示例。如果您正苦于以下问题:Java ECKey.getCreationTimeSeconds方法的具体用法?Java ECKey.getCreationTimeSeconds怎么用?Java ECKey.getCreationTimeSeconds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bitcoinj.core.ECKey
的用法示例。
在下文中一共展示了ECKey.getCreationTimeSeconds方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findOldestKeyAfter
import org.bitcoinj.core.ECKey; //导入方法依赖的package包/类
/** Returns the first ECKey created after the given UNIX time, or null if there is none. */
@Nullable
public ECKey findOldestKeyAfter(long timeSecs) {
lock.lock();
try {
ECKey oldest = null;
for (ECKey key : hashToKeys.values()) {
final long keyTime = key.getCreationTimeSeconds();
if (keyTime > timeSecs) {
if (oldest == null || oldest.getCreationTimeSeconds() > keyTime)
oldest = key;
}
}
return oldest;
} finally {
lock.unlock();
}
}
示例2: findKeysBefore
import org.bitcoinj.core.ECKey; //导入方法依赖的package包/类
/** Returns a list of all ECKeys created after the given UNIX time. */
public List<ECKey> findKeysBefore(long timeSecs) {
lock.lock();
try {
List<ECKey> results = Lists.newLinkedList();
for (ECKey key : hashToKeys.values()) {
final long keyTime = key.getCreationTimeSeconds();
if (keyTime < timeSecs) {
results.add(key);
}
}
return results;
} finally {
lock.unlock();
}
}
示例3: writeKeys
import org.bitcoinj.core.ECKey; //导入方法依赖的package包/类
public static void writeKeys(final Writer out, final List<ECKey> keys) throws IOException {
final DateFormat format = Iso8601Format.newDateTimeFormatT();
out.write("# KEEP YOUR PRIVATE KEYS SAFE! Anyone who can read this can spend your Bitcoins.\n");
for (final ECKey key : keys) {
out.write(key.getPrivateKeyEncoded(Constants.NETWORK_PARAMETERS).toBase58());
if (key.getCreationTimeSeconds() != 0) {
out.write(' ');
out.write(format.format(new Date(key.getCreationTimeSeconds() * DateUtils.SECOND_IN_MILLIS)));
}
out.write('\n');
}
}
示例4: isKeyRotating
import org.bitcoinj.core.ECKey; //导入方法依赖的package包/类
/** Returns whether the keys creation time is before the key rotation time, if one was set. */
public boolean isKeyRotating(ECKey key) {
long time = vKeyRotationTimestamp;
return time != 0 && key.getCreationTimeSeconds() < time;
}