本文整理了Java中org.bitcoinj.core.Utils.currentTimeSeconds()
方法的一些代码示例,展示了Utils.currentTimeSeconds()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.currentTimeSeconds()
方法的具体详情如下:
包路径:org.bitcoinj.core.Utils
类名称:Utils
方法名:currentTimeSeconds
暂无
代码示例来源:origin: cash.bitcoinj/bitcoinj-core
/**
* Generates a new key chain with entropy selected randomly from the given {@link java.security.SecureRandom}
* object and of the requested size in bits.
*/
public DeterministicKeyChain(SecureRandom random, int bits) {
this(random, bits, DEFAULT_PASSPHRASE_FOR_MNEMONIC, Utils.currentTimeSeconds());
}
代码示例来源:origin: cash.bitcoinj/bitcoinj-core
/**
* Generates a new key chain with entropy selected randomly from the given {@link java.security.SecureRandom}
* object and the default entropy size.
*/
public DeterministicKeyChain(SecureRandom random) {
this(random, DeterministicSeed.DEFAULT_SEED_ENTROPY_BITS, DEFAULT_PASSPHRASE_FOR_MNEMONIC, Utils.currentTimeSeconds());
}
代码示例来源:origin: fr.acinq/bitcoinj-core
/**
* Generates a new key chain with entropy selected randomly from the given {@link java.security.SecureRandom}
* object and the default entropy size.
*/
public DeterministicKeyChain(SecureRandom random, boolean useSegwit) {
this(random, DeterministicSeed.DEFAULT_SEED_ENTROPY_BITS, DEFAULT_PASSPHRASE_FOR_MNEMONIC, Utils.currentTimeSeconds(), useSegwit);
}
代码示例来源:origin: greenaddress/GreenBits
/**
* Generates a new key chain with entropy selected randomly from the given {@link java.security.SecureRandom}
* object and the default entropy size.
*/
public DeterministicKeyChain(SecureRandom random) {
this(random, DeterministicSeed.DEFAULT_SEED_ENTROPY_BITS, DEFAULT_PASSPHRASE_FOR_MNEMONIC, Utils.currentTimeSeconds());
}
代码示例来源:origin: greenaddress/GreenBits
/**
* Generates a new key chain with entropy selected randomly from the given {@link java.security.SecureRandom}
* object and of the requested size in bits.
*/
public DeterministicKeyChain(SecureRandom random, int bits) {
this(random, bits, DEFAULT_PASSPHRASE_FOR_MNEMONIC, Utils.currentTimeSeconds());
}
代码示例来源:origin: HashEngineering/dashj
/**
* Generates a new key chain with entropy selected randomly from the given {@link java.security.SecureRandom}
* object and the default entropy size.
*/
public DeterministicKeyChain(SecureRandom random) {
this(random, DeterministicSeed.DEFAULT_SEED_ENTROPY_BITS, DEFAULT_PASSPHRASE_FOR_MNEMONIC, Utils.currentTimeSeconds());
}
代码示例来源:origin: cash.bitcoinj/bitcoinj-core
/**
* Create a block sending 50BTC as a coinbase transaction to the public key specified.
* This method is intended for test use only.
*/
@VisibleForTesting
Block createNextBlockWithCoinbase(long version, byte[] pubKey, final int height) {
return createNextBlock(null, version, (TransactionOutPoint) null,
Utils.currentTimeSeconds(), pubKey, FIFTY_COINS, height);
}
代码示例来源:origin: fr.acinq/bitcoinj-core
@VisibleForTesting
public Block createNextBlockWithCoinbase(long version, byte[] pubKey, Coin coinbaseValue, final int height) {
return createNextBlock(null, version, (TransactionOutPoint) null,
Utils.currentTimeSeconds(), pubKey, coinbaseValue, height);
}
代码示例来源:origin: fr.acinq/bitcoinj-core
/**
* Create a block sending 50BTC as a coinbase transaction to the public key specified.
* This method is intended for test use only.
*/
@VisibleForTesting
Block createNextBlockWithCoinbase(long version, byte[] pubKey, final int height) {
return createNextBlock(null, version, (TransactionOutPoint) null,
Utils.currentTimeSeconds(), pubKey, FIFTY_COINS, height);
}
代码示例来源:origin: HashEngineering/dashj
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));
}
代码示例来源:origin: cash.bitcoinj/bitcoinj-core
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));
}
代码示例来源:origin: greenaddress/GreenBits
/**
* Create a block sending 50BTC as a coinbase transaction to the public key specified.
* This method is intended for test use only.
*/
@VisibleForTesting
Block createNextBlockWithCoinbase(long version, byte[] pubKey, final int height) {
return createNextBlock(null, version, (TransactionOutPoint) null,
Utils.currentTimeSeconds(), pubKey, FIFTY_COINS, height);
}
代码示例来源:origin: HashEngineering/dashj
@VisibleForTesting
public Block createNextBlockWithCoinbase(long version, byte[] pubKey, Coin coinbaseValue, final int height) {
return createNextBlock(null, version, (TransactionOutPoint) null,
Utils.currentTimeSeconds(), pubKey, coinbaseValue, height);
}
代码示例来源:origin: cash.bitcoinj/bitcoinj-core
@VisibleForTesting
public Block createNextBlockWithCoinbase(long version, byte[] pubKey, Coin coinbaseValue, final int height) {
return createNextBlock(null, version, (TransactionOutPoint) null,
Utils.currentTimeSeconds(), pubKey, coinbaseValue, height);
}
代码示例来源:origin: HashEngineering/dashj
void BumpAssetLastTime(String strFuncName)
{
if(isSynced() || isFailed()) return;
nTimeLastBumped = Utils.currentTimeSeconds();
log.info("mnsync--CMasternodeSync::BumpAssetLastTime -- "+ strFuncName);
}
代码示例来源:origin: cash.bitcoinj/bitcoinj-core
/**
* Checks if the channel is expired, setting state to {@link State#EXPIRED}, removing this channel from wallet
* storage and throwing an {@link IllegalStateException} if it is.
*/
public synchronized void checkNotExpired() {
if (Utils.currentTimeSeconds() > getExpiryTime()) {
stateMachine.transition(State.EXPIRED);
disconnectFromChannel();
throw new IllegalStateException("Channel expired");
}
}
代码示例来源:origin: fr.acinq/bitcoinj-core
/**
* Checks if the channel is expired, setting state to {@link State#EXPIRED}, removing this channel from wallet
* storage and throwing an {@link IllegalStateException} if it is.
*/
public synchronized void checkNotExpired() {
if (Utils.currentTimeSeconds() > getExpiryTime()) {
stateMachine.transition(State.EXPIRED);
disconnectFromChannel();
throw new IllegalStateException("Channel expired");
}
}
代码示例来源:origin: greenaddress/GreenBits
/** Emulates receiving a valid block that builds on top of the chain. */
public static BlockPair createFakeBlock(BlockStore blockStore, int height,
Transaction... transactions) {
return createFakeBlock(blockStore, Block.BLOCK_VERSION_GENESIS, Utils.currentTimeSeconds(), height, transactions);
}
代码示例来源:origin: greenaddress/GreenBits
@Test
public void keyCreationTime() throws Exception {
Utils.setMockClock();
long now = Utils.currentTimeSeconds();
wallet = new Wallet(PARAMS);
assertEquals(now, wallet.getEarliestKeyCreationTime());
Utils.rollMockClock(60);
wallet.freshReceiveKey();
assertEquals(now, wallet.getEarliestKeyCreationTime());
}
代码示例来源:origin: greenaddress/GreenBits
@Test
public void scriptCreationTime() throws Exception {
Utils.setMockClock();
long now = Utils.currentTimeSeconds();
wallet = new Wallet(PARAMS);
assertEquals(now, wallet.getEarliestKeyCreationTime());
Utils.rollMockClock(-120);
wallet.addWatchedAddress(OTHER_ADDRESS);
wallet.freshReceiveKey();
assertEquals(now - 120, wallet.getEarliestKeyCreationTime());
}
内容来源于网络,如有侵权,请联系作者删除!