public LNEstablishAMessage (ECKey channelKeyServer, Transaction anchor, RevocationHash revocationHash, long clientAmount, long serverAmount, int minConfirmationAnchor, Address address, int feePerByte, long csvDelay) { this.channelKeyServer = channelKeyServer.getPubKey(); this.minConfirmationAnchor = minConfirmationAnchor; this.anchorTransaction = anchor.bitcoinSerialize(); this.revocationHash = revocationHash; this.amountClient = clientAmount; this.amountServer = serverAmount; this.addressBytes = address.getHash160(); this.feePerByte = feePerByte; this.csvDelay = csvDelay; }
/** Finds whether txA spends txB */ boolean spends(Transaction txA, Transaction txB) { for (TransactionInput txInput : txA.getInputs()) { if (txInput.getOutpoint().getHash().equals(txB.getHash())) { return true; } } return false; }
@Override protected void bitcoinSerializeToStream(OutputStream stream) throws IOException { vin.bitcoinSerialize(stream); address.bitcoinSerialize(stream); pubKeyCollateralAddress.bitcoinSerialize(stream); pubKeyMasternode.bitcoinSerialize(stream); sig.bitcoinSerialize(stream); Utils.int64ToByteStreamLE(sigTime, stream); Utils.uint32ToByteStreamLE(protocolVersion, stream); lastPing.bitcoinSerialize(stream); Utils.int64ToByteStreamLE(nLastDsq, stream); }
/** * A transaction is mature if it is either a building coinbase tx that is as deep or deeper than the required coinbase depth, or a non-coinbase tx. */ public boolean isMature() { if (!isCoinBase()) return true; if (getConfidence().getConfidenceType() != ConfidenceType.BUILDING) return false; return getConfidence().getDepthInBlocks() >= params.getSpendableCoinbaseDepth(); }
private boolean isConfirmed(TransactionOutput output) { return output.getParentTransaction().getConfidence().getConfidenceType().equals(TransactionConfidence.ConfidenceType.BUILDING); } }
/** * Gets the sum of the outputs of the transaction. If the outputs are less than the inputs, it does not count the fee. * @return the sum of the outputs regardless of who owns them. */ public Coin getOutputSum() { Coin totalOut = Coin.ZERO; for (TransactionOutput output: outputs) { totalOut = totalOut.add(output.getValue()); } return totalOut; }
/** * Returns true if the digital signature attached to the message verifies. Don't do anything with the alert if it * doesn't verify, because that would allow arbitrary attackers to spam your users. */ public boolean isSignatureValid() { return ECKey.verify(Sha256Hash.hashTwice(content), signature, params.getAlertSigningKey()); }
/** * Creates an output that pays to the given pubkey directly (no address) with the given value, adds it to this * transaction, and returns the new output. */ public TransactionOutput addOutput(Coin value, ECKey pubkey) { return addOutput(new TransactionOutput(params, this, value, pubkey)); }
protected ListenableFuture<Long> ping(long nonce) throws ProtocolException { final VersionMessage ver = vPeerVersionMessage; if (!ver.isPingPongSupported()) throw new ProtocolException("Peer version is too low for measurable pings: " + ver); PendingPing pendingPing = new PendingPing(nonce); pendingPings.add(pendingPing); sendMessage(new Ping(pendingPing.nonce)); return pendingPing.future; }
@Override public boolean add(FilteredBlock block) throws VerificationException, PrunedException { boolean success = super.add(block); if (success) { trackFilteredTransactions(block.getTransactionCount()); } return success; } }
@Override public int hashCode() { int result = 1; result = 31 * result + transaction.hashCode(); result = 31 * result + hashBlock.hashCode(); result = 31 * result + coinbaseBranch.hashCode(); result = 31 * result + chainMerkleBranch.hashCode(); result = 31 * result + parentBlockHeader.hashCode(); return result; }
/** Finds whether txA spends txB */ boolean spends(Transaction txA, Transaction txB) { for (TransactionInput txInput : txA.getInputs()) { if (txInput.getOutpoint().getHash().equals(txB.getHash())) { return true; } } return false; }
/** * A transaction is mature if it is either a building coinbase tx that is as deep or deeper than the required coinbase depth, or a non-coinbase tx. */ public boolean isMature() { if (!isCoinBase()) return true; if (getConfidence().getConfidenceType() != ConfidenceType.BUILDING) return false; return getConfidence().getDepthInBlocks() >= params.getSpendableCoinbaseDepth(); }
/** * Returns true if the digital signature attached to the message verifies. Don't do anything with the alert if it * doesn't verify, because that would allow arbitrary attackers to spam your users. */ public boolean isSignatureValid() { return ECKey.verify(Sha256Hash.hashTwice(content), signature, params.getAlertSigningKey()); }
@Override public boolean add(FilteredBlock block) throws VerificationException, PrunedException { boolean success = super.add(block); if (success) { trackFilteredTransactions(block.getTransactionCount()); } return success; } }
/** Finds whether txA spends txB */ boolean spends(Transaction txA, Transaction txB) { for (TransactionInput txInput : txA.getInputs()) { if (txInput.getOutpoint().getHash().equals(txB.getHash())) { return true; } } return false; }
/** * A transaction is mature if it is either a building coinbase tx that is as deep or deeper than the required * coinbase depth, or a non-coinbase tx. */ public boolean isMature() { if (!isCoinBase()) return true; if (getConfidence().getConfidenceType() != ConfidenceType.BUILDING) return false; return getConfidence().getDepthInBlocks() >= params.getSpendableCoinbaseDepth(); }
/** * Returns true if the digital signature attached to the message verifies. Don't do anything with the alert if it * doesn't verify, because that would allow arbitrary attackers to spam your users. */ public boolean isSignatureValid() { return ECKey.verify(Sha256Hash.hashTwice(content), signature, params.getAlertSigningKey()); }
/** Finds whether txA spends txB */ boolean spends(Transaction txA, Transaction txB) { for (TransactionInput txInput : txA.getInputs()) { if (txInput.getOutpoint().getHash().equals(txB.getHash())) { return true; } } return false; }
/** * A transaction is mature if it is either a building coinbase tx that is as deep or deeper than the required coinbase depth, or a non-coinbase tx. */ public boolean isMature() { if (!isCoinBase()) return true; if (getConfidence().getConfidenceType() != ConfidenceType.BUILDING) return false; return getConfidence().getDepthInBlocks() >= params.getSpendableCoinbaseDepth(); }