long expiryTimeSeconds() { switch (majorVersion) { case 1: return refund.getLockTime() + 60 * 5; case 2: return expiryTime + 60 * 5; default: throw new IllegalStateException("Invalid version"); } }
long expiryTimeSeconds() { switch (majorVersion) { case 1: return refund.getLockTime() + 60 * 5; case 2: return expiryTime + 60 * 5; default: throw new IllegalStateException("Invalid version"); } }
long expiryTimeSeconds() { switch (majorVersion) { case 1: return refund.getLockTime() + 60 * 5; case 2: return expiryTime + 60 * 5; default: throw new IllegalStateException("Invalid version"); } }
long expiryTimeSeconds() { switch (majorVersion) { case 1: return refund.getLockTime() + 60 * 5; case 2: return expiryTime + 60 * 5; default: throw new IllegalStateException("Invalid version"); } }
/** * Returns either the lock time as a date, if it was specified in seconds, or an estimate based on the time in * the current head block if it was specified as a block time. */ public Date estimateLockTime(AbstractBlockChain chain) { if (lockTime < LOCKTIME_THRESHOLD) return chain.estimateBlockTime((int)getLockTime()); else return new Date(getLockTime()*1000); }
/** * Returns either the lock time as a date, if it was specified in seconds, or an estimate based on the time in * the current head block if it was specified as a block time. */ public Date estimateLockTime(AbstractBlockChain chain) { if (lockTime < LOCKTIME_THRESHOLD) return chain.estimateBlockTime((int)getLockTime()); else return new Date(getLockTime()*1000); }
/** * Returns either the lock time as a date, if it was specified in seconds, or an estimate based on the time in * the current head block if it was specified as a block time. */ public Date estimateLockTime(AbstractBlockChain chain) { if (lockTime < LOCKTIME_THRESHOLD) return chain.estimateBlockTime((int)getLockTime()); else return new Date(getLockTime()*1000); }
/** * Returns either the lock time as a date, if it was specified in seconds, or an estimate based on the time in * the current head block if it was specified as a block time. */ public Date estimateLockTime(AbstractBlockChain chain) { if (lockTime < LOCKTIME_THRESHOLD) return chain.estimateBlockTime((int)getLockTime()); else return new Date(getLockTime()*1000); }
/** * <p>Returns true if this transaction is considered finalized and can be placed in a block. Non-finalized * transactions won't be included by miners and can be replaced with newer versions using sequence numbers. * This is useful in certain types of <a href="http://en.bitcoin.it/wiki/Contracts">contracts</a>, such as * micropayment channels.</p> * * <p>Note that currently the replacement feature is disabled in Bitcoin Core and will need to be * re-activated before this functionality is useful.</p> */ public boolean isFinal(int height, long blockTimeSeconds) { long time = getLockTime(); return time < (time < LOCKTIME_THRESHOLD ? height : blockTimeSeconds) || !isTimeLocked(); }
/** * <p>Returns true if this transaction is considered finalized and can be placed in a block. Non-finalized * transactions won't be included by miners and can be replaced with newer versions using sequence numbers. * This is useful in certain types of <a href="http://en.bitcoin.it/wiki/Contracts">contracts</a>, such as * micropayment channels.</p> * * <p>Note that currently the replacement feature is disabled in Bitcoin Core and will need to be * re-activated before this functionality is useful.</p> */ public boolean isFinal(int height, long blockTimeSeconds) { long time = getLockTime(); return time < (time < LOCKTIME_THRESHOLD ? height : blockTimeSeconds) || !isTimeLocked(); }
/** * <p>Returns true if this transaction is considered finalized and can be placed in a block. Non-finalized * transactions won't be included by miners and can be replaced with newer versions using sequence numbers. * This is useful in certain types of <a href="http://en.bitcoin.it/wiki/Contracts">contracts</a>, such as * micropayment channels.</p> * * <p>Note that currently the replacement feature is disabled in Bitcoin Core and will need to be * re-activated before this functionality is useful.</p> */ public boolean isFinal(int height, long blockTimeSeconds) { long time = getLockTime(); return time < (time < LOCKTIME_THRESHOLD ? height : blockTimeSeconds) || !isTimeLocked(); }
/** * <p>Returns true if this transaction is considered finalized and can be placed in a block. Non-finalized * transactions won't be included by miners and can be replaced with newer versions using sequence numbers. * This is useful in certain types of <a href="http://en.bitcoin.it/wiki/Contracts">contracts</a>, such as * micropayment channels.</p> * * <p>Note that currently the replacement feature is disabled in Bitcoin Core and will need to be * re-activated before this functionality is useful.</p> */ public boolean isFinal(int height, long blockTimeSeconds) { long time = getLockTime(); return time < (time < LOCKTIME_THRESHOLD ? height : blockTimeSeconds) || !isTimeLocked(); }
/** * <p>A transaction is time locked if at least one of its inputs is non-final and it has a lock time</p> * * <p>To check if this transaction is final at a given height and time, see {@link Transaction#isFinal(int, long)} * </p> */ public boolean isTimeLocked() { if (getLockTime() == 0) return false; for (TransactionInput input : getInputs()) if (input.hasSequence()) return true; return false; }
/** * <p>A transaction is time locked if at least one of its inputs is non-final and it has a lock time</p> * * <p>To check if this transaction is final at a given height and time, see {@link Transaction#isFinal(int, long)} * </p> */ public boolean isTimeLocked() { if (getLockTime() == 0) return false; for (TransactionInput input : getInputs()) if (input.hasSequence()) return true; return false; }
/** * <p>A transaction is time locked if at least one of its inputs is non-final and it has a lock time</p> * * <p>To check if this transaction is final at a given height and time, see {@link Transaction#isFinal(int, long)} * </p> */ public boolean isTimeLocked() { if (getLockTime() == 0) return false; for (TransactionInput input : getInputs()) if (input.hasSequence()) return true; return false; }
/** * <p>A transaction is time-locked if at least one of its inputs is non-final and it has a lock time. A transaction can * also have a relative lock time which this method doesn't tell. Use {@link #hasRelativeLockTime()} to find out.</p> * * <p>To check if this transaction is final at a given height and time, see {@link Transaction#isFinal(int, long)} * </p> */ public boolean isTimeLocked() { if (getLockTime() == 0) return false; for (TransactionInput input : getInputs()) if (input.hasSequence()) return true; return false; }
PaymentChannelV1ClientState(StoredClientChannel storedClientChannel, Wallet wallet) throws VerificationException { super(storedClientChannel, wallet); // The PaymentChannelClientConnection handles storedClientChannel.active and ensures we aren't resuming channels this.multisigContract = checkNotNull(storedClientChannel.contract); this.multisigScript = multisigContract.getOutput(0).getScriptPubKey(); this.refundTx = checkNotNull(storedClientChannel.refund); this.refundFees = checkNotNull(storedClientChannel.refundFees); this.expiryTime = refundTx.getLockTime(); this.totalValue = multisigContract.getOutput(0).getValue(); stateMachine.transition(State.READY); initWalletListeners(); }
PaymentChannelV1ClientState(StoredClientChannel storedClientChannel, Wallet wallet) throws VerificationException { super(storedClientChannel, wallet); // The PaymentChannelClientConnection handles storedClientChannel.active and ensures we aren't resuming channels this.multisigContract = checkNotNull(storedClientChannel.contract); this.multisigScript = multisigContract.getOutput(0).getScriptPubKey(); this.refundTx = checkNotNull(storedClientChannel.refund); this.refundFees = checkNotNull(storedClientChannel.refundFees); this.expiryTime = refundTx.getLockTime(); this.totalValue = multisigContract.getOutput(0).getValue(); stateMachine.transition(State.READY); initWalletListeners(); }
PaymentChannelV1ClientState(StoredClientChannel storedClientChannel, Wallet wallet) throws VerificationException { super(storedClientChannel, wallet); // The PaymentChannelClientConnection handles storedClientChannel.active and ensures we aren't resuming channels this.multisigContract = checkNotNull(storedClientChannel.contract); this.multisigScript = multisigContract.getOutput(0).getScriptPubKey(); this.refundTx = checkNotNull(storedClientChannel.refund); this.refundFees = checkNotNull(storedClientChannel.refundFees); this.expiryTime = refundTx.getLockTime(); this.totalValue = multisigContract.getOutput(0).getValue(); stateMachine.transition(State.READY); initWalletListeners(); }
PaymentChannelV1ClientState(StoredClientChannel storedClientChannel, Wallet wallet) throws VerificationException { super(storedClientChannel, wallet); // The PaymentChannelClientConnection handles storedClientChannel.active and ensures we aren't resuming channels this.multisigContract = checkNotNull(storedClientChannel.contract); this.multisigScript = multisigContract.getOutput(0).getScriptPubKey(); this.refundTx = checkNotNull(storedClientChannel.refund); this.refundFees = checkNotNull(storedClientChannel.refundFees); this.expiryTime = refundTx.getLockTime(); this.totalValue = multisigContract.getOutput(0).getValue(); stateMachine.transition(State.READY); initWalletListeners(); }