id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
23,400 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/protocols/channels/PaymentChannelServerState.java | PaymentChannelServerState.incrementPayment | public synchronized boolean incrementPayment(Coin refundSize, byte[] signatureBytes)
throws SignatureDecodeException, VerificationException, ValueOutOfRangeException,
InsufficientMoneyException {
stateMachine.checkState(State.READY);
checkNotNull(refundSize);
checkNotNull... | java | public synchronized boolean incrementPayment(Coin refundSize, byte[] signatureBytes)
throws SignatureDecodeException, VerificationException, ValueOutOfRangeException,
InsufficientMoneyException {
stateMachine.checkState(State.READY);
checkNotNull(refundSize);
checkNotNull... | [
"public",
"synchronized",
"boolean",
"incrementPayment",
"(",
"Coin",
"refundSize",
",",
"byte",
"[",
"]",
"signatureBytes",
")",
"throws",
"SignatureDecodeException",
",",
"VerificationException",
",",
"ValueOutOfRangeException",
",",
"InsufficientMoneyException",
"{",
"... | Called when the client provides us with a new signature and wishes to increment total payment by size.
Verifies the provided signature and only updates values if everything checks out.
If the new refundSize is not the lowest we have seen, it is simply ignored.
@param refundSize How many satoshis of the original contra... | [
"Called",
"when",
"the",
"client",
"provides",
"us",
"with",
"a",
"new",
"signature",
"and",
"wishes",
"to",
"increment",
"total",
"payment",
"by",
"size",
".",
"Verifies",
"the",
"provided",
"signature",
"and",
"only",
"updates",
"values",
"if",
"everything",... | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/protocols/channels/PaymentChannelServerState.java#L240-L297 |
23,401 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/utils/BtcAutoFormat.java | BtcAutoFormat.scale | @Override
protected int scale(BigInteger satoshis, int fractionPlaces) {
/* The algorithm is as follows. TODO: is there a way to optimize step 4?
1. Can we use coin denomination w/ no rounding? If yes, do it.
2. Else, can we use millicoin denomination w/ no rounding? If yes, do it.
... | java | @Override
protected int scale(BigInteger satoshis, int fractionPlaces) {
/* The algorithm is as follows. TODO: is there a way to optimize step 4?
1. Can we use coin denomination w/ no rounding? If yes, do it.
2. Else, can we use millicoin denomination w/ no rounding? If yes, do it.
... | [
"@",
"Override",
"protected",
"int",
"scale",
"(",
"BigInteger",
"satoshis",
",",
"int",
"fractionPlaces",
")",
"{",
"/* The algorithm is as follows. TODO: is there a way to optimize step 4?\n 1. Can we use coin denomination w/ no rounding? If yes, do it.\n 2. Else, c... | Calculate the appropriate denomination for the given Bitcoin monetary value. This
method takes a BigInteger representing a quantity of satoshis, and returns the
number of places that value's decimal point is to be moved when formatting said value
in order that the resulting number represents the correct quantity of de... | [
"Calculate",
"the",
"appropriate",
"denomination",
"for",
"the",
"given",
"Bitcoin",
"monetary",
"value",
".",
"This",
"method",
"takes",
"a",
"BigInteger",
"representing",
"a",
"quantity",
"of",
"satoshis",
"and",
"returns",
"the",
"number",
"of",
"places",
"th... | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/utils/BtcAutoFormat.java#L127-L172 |
23,402 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/FilteredBlock.java | FilteredBlock.getTransactionHashes | public List<Sha256Hash> getTransactionHashes() throws VerificationException {
if (cachedTransactionHashes != null)
return Collections.unmodifiableList(cachedTransactionHashes);
List<Sha256Hash> hashesMatched = new LinkedList<>();
if (header.getMerkleRoot().equals(merkleTree.getTxnHas... | java | public List<Sha256Hash> getTransactionHashes() throws VerificationException {
if (cachedTransactionHashes != null)
return Collections.unmodifiableList(cachedTransactionHashes);
List<Sha256Hash> hashesMatched = new LinkedList<>();
if (header.getMerkleRoot().equals(merkleTree.getTxnHas... | [
"public",
"List",
"<",
"Sha256Hash",
">",
"getTransactionHashes",
"(",
")",
"throws",
"VerificationException",
"{",
"if",
"(",
"cachedTransactionHashes",
"!=",
"null",
")",
"return",
"Collections",
".",
"unmodifiableList",
"(",
"cachedTransactionHashes",
")",
";",
"... | Gets a list of leaf hashes which are contained in the partial merkle tree in this filtered block
@throws ProtocolException If the partial merkle block is invalid or the merkle root of the partial merkle block doesn't match the block header | [
"Gets",
"a",
"list",
"of",
"leaf",
"hashes",
"which",
"are",
"contained",
"in",
"the",
"partial",
"merkle",
"tree",
"in",
"this",
"filtered",
"block"
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/FilteredBlock.java#L75-L84 |
23,403 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/FilteredBlock.java | FilteredBlock.provideTransaction | public boolean provideTransaction(Transaction tx) throws VerificationException {
Sha256Hash hash = tx.getTxId();
if (getTransactionHashes().contains(hash)) {
associatedTransactions.put(hash, tx);
return true;
}
return false;
} | java | public boolean provideTransaction(Transaction tx) throws VerificationException {
Sha256Hash hash = tx.getTxId();
if (getTransactionHashes().contains(hash)) {
associatedTransactions.put(hash, tx);
return true;
}
return false;
} | [
"public",
"boolean",
"provideTransaction",
"(",
"Transaction",
"tx",
")",
"throws",
"VerificationException",
"{",
"Sha256Hash",
"hash",
"=",
"tx",
".",
"getTxId",
"(",
")",
";",
"if",
"(",
"getTransactionHashes",
"(",
")",
".",
"contains",
"(",
"hash",
")",
... | Provide this FilteredBlock with a transaction which is in its Merkle tree.
@return false if the tx is not relevant to this FilteredBlock | [
"Provide",
"this",
"FilteredBlock",
"with",
"a",
"transaction",
"which",
"is",
"in",
"its",
"Merkle",
"tree",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/FilteredBlock.java#L103-L110 |
23,404 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/protocols/payments/PaymentProtocol.java | PaymentProtocol.parsePaymentRequest | public static PaymentSession parsePaymentRequest(Protos.PaymentRequest paymentRequest)
throws PaymentProtocolException {
return new PaymentSession(paymentRequest, false, null);
} | java | public static PaymentSession parsePaymentRequest(Protos.PaymentRequest paymentRequest)
throws PaymentProtocolException {
return new PaymentSession(paymentRequest, false, null);
} | [
"public",
"static",
"PaymentSession",
"parsePaymentRequest",
"(",
"Protos",
".",
"PaymentRequest",
"paymentRequest",
")",
"throws",
"PaymentProtocolException",
"{",
"return",
"new",
"PaymentSession",
"(",
"paymentRequest",
",",
"false",
",",
"null",
")",
";",
"}"
] | Parse a payment request.
@param paymentRequest payment request to parse
@return instance of {@link PaymentSession}, used as a value object
@throws PaymentProtocolException | [
"Parse",
"a",
"payment",
"request",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/protocols/payments/PaymentProtocol.java#L113-L116 |
23,405 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/protocols/payments/PaymentProtocol.java | PaymentProtocol.signPaymentRequest | public static void signPaymentRequest(Protos.PaymentRequest.Builder paymentRequest,
X509Certificate[] certificateChain, PrivateKey privateKey) {
try {
final Protos.X509Certificates.Builder certificates = Protos.X509Certificates.newBuilder();
for ... | java | public static void signPaymentRequest(Protos.PaymentRequest.Builder paymentRequest,
X509Certificate[] certificateChain, PrivateKey privateKey) {
try {
final Protos.X509Certificates.Builder certificates = Protos.X509Certificates.newBuilder();
for ... | [
"public",
"static",
"void",
"signPaymentRequest",
"(",
"Protos",
".",
"PaymentRequest",
".",
"Builder",
"paymentRequest",
",",
"X509Certificate",
"[",
"]",
"certificateChain",
",",
"PrivateKey",
"privateKey",
")",
"{",
"try",
"{",
"final",
"Protos",
".",
"X509Cert... | Sign the provided payment request.
@param paymentRequest Payment request to sign, in its builder form.
@param certificateChain Certificate chain to send with the payment request, ordered from client certificate to root
certificate. The root certificate itself may be omitted.
@param privateKey The key to sign with. Mus... | [
"Sign",
"the",
"provided",
"payment",
"request",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/protocols/payments/PaymentProtocol.java#L126-L153 |
23,406 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/protocols/payments/PaymentProtocol.java | PaymentProtocol.parseTransactionsFromPaymentMessage | public static List<Transaction> parseTransactionsFromPaymentMessage(NetworkParameters params,
Protos.Payment paymentMessage) {
final List<Transaction> transactions = new ArrayList<>(paymentMessage.getTransactionsCount());
for (final ByteString transaction : paymentMessage.getTransactionsList... | java | public static List<Transaction> parseTransactionsFromPaymentMessage(NetworkParameters params,
Protos.Payment paymentMessage) {
final List<Transaction> transactions = new ArrayList<>(paymentMessage.getTransactionsCount());
for (final ByteString transaction : paymentMessage.getTransactionsList... | [
"public",
"static",
"List",
"<",
"Transaction",
">",
"parseTransactionsFromPaymentMessage",
"(",
"NetworkParameters",
"params",
",",
"Protos",
".",
"Payment",
"paymentMessage",
")",
"{",
"final",
"List",
"<",
"Transaction",
">",
"transactions",
"=",
"new",
"ArrayLis... | Parse transactions from payment message.
@param params network parameters (needed for transaction deserialization)
@param paymentMessage payment message to parse
@return list of transactions | [
"Parse",
"transactions",
"from",
"payment",
"message",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/protocols/payments/PaymentProtocol.java#L341-L347 |
23,407 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/protocols/payments/PaymentProtocol.java | PaymentProtocol.parsePaymentAck | public static Ack parsePaymentAck(Protos.PaymentACK paymentAck) {
final String memo = paymentAck.hasMemo() ? paymentAck.getMemo() : null;
return new Ack(memo);
} | java | public static Ack parsePaymentAck(Protos.PaymentACK paymentAck) {
final String memo = paymentAck.hasMemo() ? paymentAck.getMemo() : null;
return new Ack(memo);
} | [
"public",
"static",
"Ack",
"parsePaymentAck",
"(",
"Protos",
".",
"PaymentACK",
"paymentAck",
")",
"{",
"final",
"String",
"memo",
"=",
"paymentAck",
".",
"hasMemo",
"(",
")",
"?",
"paymentAck",
".",
"getMemo",
"(",
")",
":",
"null",
";",
"return",
"new",
... | Parse payment ack into an object. | [
"Parse",
"payment",
"ack",
"into",
"an",
"object",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/protocols/payments/PaymentProtocol.java#L387-L390 |
23,408 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/crypto/HDUtils.java | HDUtils.append | public static ImmutableList<ChildNumber> append(List<ChildNumber> path, ChildNumber childNumber) {
return ImmutableList.<ChildNumber>builder().addAll(path).add(childNumber).build();
} | java | public static ImmutableList<ChildNumber> append(List<ChildNumber> path, ChildNumber childNumber) {
return ImmutableList.<ChildNumber>builder().addAll(path).add(childNumber).build();
} | [
"public",
"static",
"ImmutableList",
"<",
"ChildNumber",
">",
"append",
"(",
"List",
"<",
"ChildNumber",
">",
"path",
",",
"ChildNumber",
"childNumber",
")",
"{",
"return",
"ImmutableList",
".",
"<",
"ChildNumber",
">",
"builder",
"(",
")",
".",
"addAll",
"(... | Append a derivation level to an existing path | [
"Append",
"a",
"derivation",
"level",
"to",
"an",
"existing",
"path"
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/crypto/HDUtils.java#L71-L73 |
23,409 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/crypto/HDUtils.java | HDUtils.concat | public static ImmutableList<ChildNumber> concat(List<ChildNumber> path, List<ChildNumber> path2) {
return ImmutableList.<ChildNumber>builder().addAll(path).addAll(path2).build();
} | java | public static ImmutableList<ChildNumber> concat(List<ChildNumber> path, List<ChildNumber> path2) {
return ImmutableList.<ChildNumber>builder().addAll(path).addAll(path2).build();
} | [
"public",
"static",
"ImmutableList",
"<",
"ChildNumber",
">",
"concat",
"(",
"List",
"<",
"ChildNumber",
">",
"path",
",",
"List",
"<",
"ChildNumber",
">",
"path2",
")",
"{",
"return",
"ImmutableList",
".",
"<",
"ChildNumber",
">",
"builder",
"(",
")",
"."... | Concatenate two derivation paths | [
"Concatenate",
"two",
"derivation",
"paths"
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/crypto/HDUtils.java#L76-L78 |
23,410 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/Transaction.java | Transaction.getTxId | public Sha256Hash getTxId() {
if (cachedTxId == null) {
if (!hasWitnesses() && cachedWTxId != null) {
cachedTxId = cachedWTxId;
} else {
ByteArrayOutputStream stream = new UnsafeByteArrayOutputStream(length < 32 ? 32 : length + 32);
try {
... | java | public Sha256Hash getTxId() {
if (cachedTxId == null) {
if (!hasWitnesses() && cachedWTxId != null) {
cachedTxId = cachedWTxId;
} else {
ByteArrayOutputStream stream = new UnsafeByteArrayOutputStream(length < 32 ? 32 : length + 32);
try {
... | [
"public",
"Sha256Hash",
"getTxId",
"(",
")",
"{",
"if",
"(",
"cachedTxId",
"==",
"null",
")",
"{",
"if",
"(",
"!",
"hasWitnesses",
"(",
")",
"&&",
"cachedWTxId",
"!=",
"null",
")",
"{",
"cachedTxId",
"=",
"cachedWTxId",
";",
"}",
"else",
"{",
"ByteArra... | Returns the transaction id as you see them in block explorers. It is used as a reference by transaction inputs
via outpoints. | [
"Returns",
"the",
"transaction",
"id",
"as",
"you",
"see",
"them",
"in",
"block",
"explorers",
".",
"It",
"is",
"used",
"as",
"a",
"reference",
"by",
"transaction",
"inputs",
"via",
"outpoints",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Transaction.java#L272-L287 |
23,411 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/Transaction.java | Transaction.getWeight | public int getWeight() {
if (!hasWitnesses())
return getMessageSize() * 4;
try (final ByteArrayOutputStream stream = new UnsafeByteArrayOutputStream(length)) {
bitcoinSerializeToStream(stream, false);
final int baseSize = stream.size();
stream.reset();
... | java | public int getWeight() {
if (!hasWitnesses())
return getMessageSize() * 4;
try (final ByteArrayOutputStream stream = new UnsafeByteArrayOutputStream(length)) {
bitcoinSerializeToStream(stream, false);
final int baseSize = stream.size();
stream.reset();
... | [
"public",
"int",
"getWeight",
"(",
")",
"{",
"if",
"(",
"!",
"hasWitnesses",
"(",
")",
")",
"return",
"getMessageSize",
"(",
")",
"*",
"4",
";",
"try",
"(",
"final",
"ByteArrayOutputStream",
"stream",
"=",
"new",
"UnsafeByteArrayOutputStream",
"(",
"length",... | Gets the transaction weight as defined in BIP141. | [
"Gets",
"the",
"transaction",
"weight",
"as",
"defined",
"in",
"BIP141",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Transaction.java#L311-L324 |
23,412 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/Transaction.java | Transaction.getInputSum | public Coin getInputSum() {
Coin inputTotal = Coin.ZERO;
for (TransactionInput input: inputs) {
Coin inputValue = input.getValue();
if (inputValue != null) {
inputTotal = inputTotal.add(inputValue);
}
}
return inputTotal;
} | java | public Coin getInputSum() {
Coin inputTotal = Coin.ZERO;
for (TransactionInput input: inputs) {
Coin inputValue = input.getValue();
if (inputValue != null) {
inputTotal = inputTotal.add(inputValue);
}
}
return inputTotal;
} | [
"public",
"Coin",
"getInputSum",
"(",
")",
"{",
"Coin",
"inputTotal",
"=",
"Coin",
".",
"ZERO",
";",
"for",
"(",
"TransactionInput",
"input",
":",
"inputs",
")",
"{",
"Coin",
"inputValue",
"=",
"input",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"input... | Gets the sum of the inputs, regardless of who owns them. | [
"Gets",
"the",
"sum",
"of",
"the",
"inputs",
"regardless",
"of",
"who",
"owns",
"them",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Transaction.java#L336-L347 |
23,413 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/Transaction.java | Transaction.getValueSentToMe | public Coin getValueSentToMe(TransactionBag transactionBag) {
// This is tested in WalletTest.
Coin v = Coin.ZERO;
for (TransactionOutput o : outputs) {
if (!o.isMineOrWatched(transactionBag)) continue;
v = v.add(o.getValue());
}
return v;
} | java | public Coin getValueSentToMe(TransactionBag transactionBag) {
// This is tested in WalletTest.
Coin v = Coin.ZERO;
for (TransactionOutput o : outputs) {
if (!o.isMineOrWatched(transactionBag)) continue;
v = v.add(o.getValue());
}
return v;
} | [
"public",
"Coin",
"getValueSentToMe",
"(",
"TransactionBag",
"transactionBag",
")",
"{",
"// This is tested in WalletTest.",
"Coin",
"v",
"=",
"Coin",
".",
"ZERO",
";",
"for",
"(",
"TransactionOutput",
"o",
":",
"outputs",
")",
"{",
"if",
"(",
"!",
"o",
".",
... | Calculates the sum of the outputs that are sending coins to a key in the wallet. | [
"Calculates",
"the",
"sum",
"of",
"the",
"outputs",
"that",
"are",
"sending",
"coins",
"to",
"a",
"key",
"in",
"the",
"wallet",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Transaction.java#L352-L360 |
23,414 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/Transaction.java | Transaction.getValueSentFromMe | public Coin getValueSentFromMe(TransactionBag wallet) throws ScriptException {
// This is tested in WalletTest.
Coin v = Coin.ZERO;
for (TransactionInput input : inputs) {
// This input is taking value from a transaction in our wallet. To discover the value,
// we must fi... | java | public Coin getValueSentFromMe(TransactionBag wallet) throws ScriptException {
// This is tested in WalletTest.
Coin v = Coin.ZERO;
for (TransactionInput input : inputs) {
// This input is taking value from a transaction in our wallet. To discover the value,
// we must fi... | [
"public",
"Coin",
"getValueSentFromMe",
"(",
"TransactionBag",
"wallet",
")",
"throws",
"ScriptException",
"{",
"// This is tested in WalletTest.",
"Coin",
"v",
"=",
"Coin",
".",
"ZERO",
";",
"for",
"(",
"TransactionInput",
"input",
":",
"inputs",
")",
"{",
"// Th... | Calculates the sum of the inputs that are spending coins with keys in the wallet. This requires the
transactions sending coins to those keys to be in the wallet. This method will not attempt to download the
blocks containing the input transactions if the key is in the wallet but the transactions are not.
@return sum o... | [
"Calculates",
"the",
"sum",
"of",
"the",
"inputs",
"that",
"are",
"spending",
"coins",
"with",
"keys",
"in",
"the",
"wallet",
".",
"This",
"requires",
"the",
"transactions",
"sending",
"coins",
"to",
"those",
"keys",
"to",
"be",
"in",
"the",
"wallet",
".",... | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Transaction.java#L424-L444 |
23,415 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/Transaction.java | Transaction.getOutputSum | public Coin getOutputSum() {
Coin totalOut = Coin.ZERO;
for (TransactionOutput output: outputs) {
totalOut = totalOut.add(output.getValue());
}
return totalOut;
} | java | public Coin getOutputSum() {
Coin totalOut = Coin.ZERO;
for (TransactionOutput output: outputs) {
totalOut = totalOut.add(output.getValue());
}
return totalOut;
} | [
"public",
"Coin",
"getOutputSum",
"(",
")",
"{",
"Coin",
"totalOut",
"=",
"Coin",
".",
"ZERO",
";",
"for",
"(",
"TransactionOutput",
"output",
":",
"outputs",
")",
"{",
"totalOut",
"=",
"totalOut",
".",
"add",
"(",
"output",
".",
"getValue",
"(",
")",
... | 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. | [
"Gets",
"the",
"sum",
"of",
"the",
"outputs",
"of",
"the",
"transaction",
".",
"If",
"the",
"outputs",
"are",
"less",
"than",
"the",
"inputs",
"it",
"does",
"not",
"count",
"the",
"fee",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Transaction.java#L450-L458 |
23,416 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/Transaction.java | Transaction.getFee | public Coin getFee() {
Coin fee = Coin.ZERO;
if (inputs.isEmpty() || outputs.isEmpty()) // Incomplete transaction
return null;
for (TransactionInput input : inputs) {
if (input.getValue() == null)
return null;
fee = fee.add(input.getValue());
... | java | public Coin getFee() {
Coin fee = Coin.ZERO;
if (inputs.isEmpty() || outputs.isEmpty()) // Incomplete transaction
return null;
for (TransactionInput input : inputs) {
if (input.getValue() == null)
return null;
fee = fee.add(input.getValue());
... | [
"public",
"Coin",
"getFee",
"(",
")",
"{",
"Coin",
"fee",
"=",
"Coin",
".",
"ZERO",
";",
"if",
"(",
"inputs",
".",
"isEmpty",
"(",
")",
"||",
"outputs",
".",
"isEmpty",
"(",
")",
")",
"// Incomplete transaction",
"return",
"null",
";",
"for",
"(",
"T... | The transaction fee is the difference of the value of all inputs and the value of all outputs. Currently, the fee
can only be determined for transactions created by us.
@return fee, or null if it cannot be determined | [
"The",
"transaction",
"fee",
"is",
"the",
"difference",
"of",
"the",
"value",
"of",
"all",
"inputs",
"and",
"the",
"value",
"of",
"all",
"outputs",
".",
"Currently",
"the",
"fee",
"can",
"only",
"be",
"determined",
"for",
"transactions",
"created",
"by",
"... | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Transaction.java#L485-L498 |
23,417 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/Transaction.java | Transaction.isEveryOwnedOutputSpent | public boolean isEveryOwnedOutputSpent(TransactionBag transactionBag) {
for (TransactionOutput output : outputs) {
if (output.isAvailableForSpending() && output.isMineOrWatched(transactionBag))
return false;
}
return true;
} | java | public boolean isEveryOwnedOutputSpent(TransactionBag transactionBag) {
for (TransactionOutput output : outputs) {
if (output.isAvailableForSpending() && output.isMineOrWatched(transactionBag))
return false;
}
return true;
} | [
"public",
"boolean",
"isEveryOwnedOutputSpent",
"(",
"TransactionBag",
"transactionBag",
")",
"{",
"for",
"(",
"TransactionOutput",
"output",
":",
"outputs",
")",
"{",
"if",
"(",
"output",
".",
"isAvailableForSpending",
"(",
")",
"&&",
"output",
".",
"isMineOrWatc... | Returns false if this transaction has at least one output that is owned by the given wallet and unspent, true
otherwise. | [
"Returns",
"false",
"if",
"this",
"transaction",
"has",
"at",
"least",
"one",
"output",
"that",
"is",
"owned",
"by",
"the",
"given",
"wallet",
"and",
"unspent",
"true",
"otherwise",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Transaction.java#L515-L521 |
23,418 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/Transaction.java | Transaction.isMature | public boolean isMature() {
if (!isCoinBase())
return true;
if (getConfidence().getConfidenceType() != ConfidenceType.BUILDING)
return false;
return getConfidence().getDepthInBlocks() >= params.getSpendableCoinbaseDepth();
} | java | public boolean isMature() {
if (!isCoinBase())
return true;
if (getConfidence().getConfidenceType() != ConfidenceType.BUILDING)
return false;
return getConfidence().getDepthInBlocks() >= params.getSpendableCoinbaseDepth();
} | [
"public",
"boolean",
"isMature",
"(",
")",
"{",
"if",
"(",
"!",
"isCoinBase",
"(",
")",
")",
"return",
"true",
";",
"if",
"(",
"getConfidence",
"(",
")",
".",
"getConfidenceType",
"(",
")",
"!=",
"ConfidenceType",
".",
"BUILDING",
")",
"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. | [
"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",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Transaction.java#L739-L747 |
23,419 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/Transaction.java | Transaction.clearInputs | public void clearInputs() {
unCache();
for (TransactionInput input : inputs) {
input.setParent(null);
}
inputs.clear();
// You wanted to reserialize, right?
this.length = this.unsafeBitcoinSerialize().length;
} | java | public void clearInputs() {
unCache();
for (TransactionInput input : inputs) {
input.setParent(null);
}
inputs.clear();
// You wanted to reserialize, right?
this.length = this.unsafeBitcoinSerialize().length;
} | [
"public",
"void",
"clearInputs",
"(",
")",
"{",
"unCache",
"(",
")",
";",
"for",
"(",
"TransactionInput",
"input",
":",
"inputs",
")",
"{",
"input",
".",
"setParent",
"(",
"null",
")",
";",
"}",
"inputs",
".",
"clear",
"(",
")",
";",
"// You wanted to ... | Removes all the inputs from this transaction.
Note that this also invalidates the length attribute | [
"Removes",
"all",
"the",
"inputs",
"from",
"this",
"transaction",
".",
"Note",
"that",
"this",
"also",
"invalidates",
"the",
"length",
"attribute"
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Transaction.java#L910-L918 |
23,420 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/Transaction.java | Transaction.addInput | public TransactionInput addInput(TransactionInput input) {
unCache();
input.setParent(this);
inputs.add(input);
adjustLength(inputs.size(), input.length);
return input;
} | java | public TransactionInput addInput(TransactionInput input) {
unCache();
input.setParent(this);
inputs.add(input);
adjustLength(inputs.size(), input.length);
return input;
} | [
"public",
"TransactionInput",
"addInput",
"(",
"TransactionInput",
"input",
")",
"{",
"unCache",
"(",
")",
";",
"input",
".",
"setParent",
"(",
"this",
")",
";",
"inputs",
".",
"add",
"(",
"input",
")",
";",
"adjustLength",
"(",
"inputs",
".",
"size",
"(... | Adds an input directly, with no checking that it's valid.
@return the new input. | [
"Adds",
"an",
"input",
"directly",
"with",
"no",
"checking",
"that",
"it",
"s",
"valid",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Transaction.java#L935-L941 |
23,421 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/Transaction.java | Transaction.addInput | public TransactionInput addInput(Sha256Hash spendTxHash, long outputIndex, Script script) {
return addInput(new TransactionInput(params, this, script.getProgram(), new TransactionOutPoint(params, outputIndex, spendTxHash)));
} | java | public TransactionInput addInput(Sha256Hash spendTxHash, long outputIndex, Script script) {
return addInput(new TransactionInput(params, this, script.getProgram(), new TransactionOutPoint(params, outputIndex, spendTxHash)));
} | [
"public",
"TransactionInput",
"addInput",
"(",
"Sha256Hash",
"spendTxHash",
",",
"long",
"outputIndex",
",",
"Script",
"script",
")",
"{",
"return",
"addInput",
"(",
"new",
"TransactionInput",
"(",
"params",
",",
"this",
",",
"script",
".",
"getProgram",
"(",
... | Creates and adds an input to this transaction, with no checking that it's valid.
@return the newly created input. | [
"Creates",
"and",
"adds",
"an",
"input",
"to",
"this",
"transaction",
"with",
"no",
"checking",
"that",
"it",
"s",
"valid",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Transaction.java#L947-L949 |
23,422 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/Transaction.java | Transaction.clearOutputs | public void clearOutputs() {
unCache();
for (TransactionOutput output : outputs) {
output.setParent(null);
}
outputs.clear();
// You wanted to reserialize, right?
this.length = this.unsafeBitcoinSerialize().length;
} | java | public void clearOutputs() {
unCache();
for (TransactionOutput output : outputs) {
output.setParent(null);
}
outputs.clear();
// You wanted to reserialize, right?
this.length = this.unsafeBitcoinSerialize().length;
} | [
"public",
"void",
"clearOutputs",
"(",
")",
"{",
"unCache",
"(",
")",
";",
"for",
"(",
"TransactionOutput",
"output",
":",
"outputs",
")",
"{",
"output",
".",
"setParent",
"(",
"null",
")",
";",
"}",
"outputs",
".",
"clear",
"(",
")",
";",
"// You want... | Removes all the outputs from this transaction.
Note that this also invalidates the length attribute | [
"Removes",
"all",
"the",
"outputs",
"from",
"this",
"transaction",
".",
"Note",
"that",
"this",
"also",
"invalidates",
"the",
"length",
"attribute"
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Transaction.java#L1017-L1025 |
23,423 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/Transaction.java | Transaction.addOutput | public TransactionOutput addOutput(TransactionOutput to) {
unCache();
to.setParent(this);
outputs.add(to);
adjustLength(outputs.size(), to.length);
return to;
} | java | public TransactionOutput addOutput(TransactionOutput to) {
unCache();
to.setParent(this);
outputs.add(to);
adjustLength(outputs.size(), to.length);
return to;
} | [
"public",
"TransactionOutput",
"addOutput",
"(",
"TransactionOutput",
"to",
")",
"{",
"unCache",
"(",
")",
";",
"to",
".",
"setParent",
"(",
"this",
")",
";",
"outputs",
".",
"add",
"(",
"to",
")",
";",
"adjustLength",
"(",
"outputs",
".",
"size",
"(",
... | Adds the given output to this transaction. The output must be completely initialized. Returns the given output. | [
"Adds",
"the",
"given",
"output",
"to",
"this",
"transaction",
".",
"The",
"output",
"must",
"be",
"completely",
"initialized",
".",
"Returns",
"the",
"given",
"output",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Transaction.java#L1030-L1036 |
23,424 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/Transaction.java | Transaction.addOutput | public TransactionOutput addOutput(Coin value, Address address) {
return addOutput(new TransactionOutput(params, this, value, address));
} | java | public TransactionOutput addOutput(Coin value, Address address) {
return addOutput(new TransactionOutput(params, this, value, address));
} | [
"public",
"TransactionOutput",
"addOutput",
"(",
"Coin",
"value",
",",
"Address",
"address",
")",
"{",
"return",
"addOutput",
"(",
"new",
"TransactionOutput",
"(",
"params",
",",
"this",
",",
"value",
",",
"address",
")",
")",
";",
"}"
] | Creates an output based on the given address and value, adds it to this transaction, and returns the new output. | [
"Creates",
"an",
"output",
"based",
"on",
"the",
"given",
"address",
"and",
"value",
"adds",
"it",
"to",
"this",
"transaction",
"and",
"returns",
"the",
"new",
"output",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Transaction.java#L1041-L1043 |
23,425 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/Transaction.java | Transaction.addOutput | public TransactionOutput addOutput(Coin value, Script script) {
return addOutput(new TransactionOutput(params, this, value, script.getProgram()));
} | java | public TransactionOutput addOutput(Coin value, Script script) {
return addOutput(new TransactionOutput(params, this, value, script.getProgram()));
} | [
"public",
"TransactionOutput",
"addOutput",
"(",
"Coin",
"value",
",",
"Script",
"script",
")",
"{",
"return",
"addOutput",
"(",
"new",
"TransactionOutput",
"(",
"params",
",",
"this",
",",
"value",
",",
"script",
".",
"getProgram",
"(",
")",
")",
")",
";"... | Creates an output that pays to the given script. The address and key forms are specialisations of this method,
you won't normally need to use it unless you're doing unusual things. | [
"Creates",
"an",
"output",
"that",
"pays",
"to",
"the",
"given",
"script",
".",
"The",
"address",
"and",
"key",
"forms",
"are",
"specialisations",
"of",
"this",
"method",
"you",
"won",
"t",
"normally",
"need",
"to",
"use",
"it",
"unless",
"you",
"re",
"d... | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Transaction.java#L1057-L1059 |
23,426 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/Transaction.java | Transaction.hashForSignature | public Sha256Hash hashForSignature(int inputIndex, byte[] connectedScript, byte sigHashType) {
// The SIGHASH flags are used in the design of contracts, please see this page for a further understanding of
// the purposes of the code in this method:
//
// https://en.bitcoin.it/wiki/Cont... | java | public Sha256Hash hashForSignature(int inputIndex, byte[] connectedScript, byte sigHashType) {
// The SIGHASH flags are used in the design of contracts, please see this page for a further understanding of
// the purposes of the code in this method:
//
// https://en.bitcoin.it/wiki/Cont... | [
"public",
"Sha256Hash",
"hashForSignature",
"(",
"int",
"inputIndex",
",",
"byte",
"[",
"]",
"connectedScript",
",",
"byte",
"sigHashType",
")",
"{",
"// The SIGHASH flags are used in the design of contracts, please see this page for a further understanding of",
"// the purposes of... | This is required for signatures which use a sigHashType which cannot be represented using SigHash and anyoneCanPay
See transaction c99c49da4c38af669dea436d3e73780dfdb6c1ecf9958baa52960e8baee30e73, which has sigHashType 0 | [
"This",
"is",
"required",
"for",
"signatures",
"which",
"use",
"a",
"sigHashType",
"which",
"cannot",
"be",
"represented",
"using",
"SigHash",
"and",
"anyoneCanPay",
"See",
"transaction",
"c99c49da4c38af669dea436d3e73780dfdb6c1ecf9958baa52960e8baee30e73",
"which",
"has",
... | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Transaction.java#L1188-L1274 |
23,427 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/Transaction.java | Transaction.getSigOpCount | public int getSigOpCount() throws ScriptException {
int sigOps = 0;
for (TransactionInput input : inputs)
sigOps += Script.getSigOpCount(input.getScriptBytes());
for (TransactionOutput output : outputs)
sigOps += Script.getSigOpCount(output.getScriptBytes());
retu... | java | public int getSigOpCount() throws ScriptException {
int sigOps = 0;
for (TransactionInput input : inputs)
sigOps += Script.getSigOpCount(input.getScriptBytes());
for (TransactionOutput output : outputs)
sigOps += Script.getSigOpCount(output.getScriptBytes());
retu... | [
"public",
"int",
"getSigOpCount",
"(",
")",
"throws",
"ScriptException",
"{",
"int",
"sigOps",
"=",
"0",
";",
"for",
"(",
"TransactionInput",
"input",
":",
"inputs",
")",
"sigOps",
"+=",
"Script",
".",
"getSigOpCount",
"(",
"input",
".",
"getScriptBytes",
"(... | Gets the count of regular SigOps in this transactions | [
"Gets",
"the",
"count",
"of",
"regular",
"SigOps",
"in",
"this",
"transactions"
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Transaction.java#L1592-L1599 |
23,428 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/Transaction.java | Transaction.checkCoinBaseHeight | public void checkCoinBaseHeight(final int height)
throws VerificationException {
checkArgument(height >= Block.BLOCK_HEIGHT_GENESIS);
checkState(isCoinBase());
// Check block height is in coinbase input script
final TransactionInput in = this.getInputs().get(0);
fina... | java | public void checkCoinBaseHeight(final int height)
throws VerificationException {
checkArgument(height >= Block.BLOCK_HEIGHT_GENESIS);
checkState(isCoinBase());
// Check block height is in coinbase input script
final TransactionInput in = this.getInputs().get(0);
fina... | [
"public",
"void",
"checkCoinBaseHeight",
"(",
"final",
"int",
"height",
")",
"throws",
"VerificationException",
"{",
"checkArgument",
"(",
"height",
">=",
"Block",
".",
"BLOCK_HEIGHT_GENESIS",
")",
";",
"checkState",
"(",
"isCoinBase",
"(",
")",
")",
";",
"// Ch... | Check block height is in coinbase input script, for use after BIP 34
enforcement is enabled. | [
"Check",
"block",
"height",
"is",
"in",
"coinbase",
"input",
"script",
"for",
"use",
"after",
"BIP",
"34",
"enforcement",
"is",
"enabled",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Transaction.java#L1605-L1624 |
23,429 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/Transaction.java | Transaction.findWitnessCommitment | public Sha256Hash findWitnessCommitment() {
checkState(isCoinBase());
for (TransactionOutput out : Lists.reverse(outputs)) {
Script scriptPubKey = out.getScriptPubKey();
if (ScriptPattern.isWitnessCommitment(scriptPubKey))
return ScriptPattern.extractWitnessCommit... | java | public Sha256Hash findWitnessCommitment() {
checkState(isCoinBase());
for (TransactionOutput out : Lists.reverse(outputs)) {
Script scriptPubKey = out.getScriptPubKey();
if (ScriptPattern.isWitnessCommitment(scriptPubKey))
return ScriptPattern.extractWitnessCommit... | [
"public",
"Sha256Hash",
"findWitnessCommitment",
"(",
")",
"{",
"checkState",
"(",
"isCoinBase",
"(",
")",
")",
";",
"for",
"(",
"TransactionOutput",
"out",
":",
"Lists",
".",
"reverse",
"(",
"outputs",
")",
")",
"{",
"Script",
"scriptPubKey",
"=",
"out",
... | Loops the outputs of a coinbase transaction to locate the witness commitment. | [
"Loops",
"the",
"outputs",
"of",
"a",
"coinbase",
"transaction",
"to",
"locate",
"the",
"witness",
"commitment",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Transaction.java#L1627-L1635 |
23,430 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/Transaction.java | Transaction.estimateLockTime | public Date estimateLockTime(AbstractBlockChain chain) {
if (lockTime < LOCKTIME_THRESHOLD)
return chain.estimateBlockTime((int)getLockTime());
else
return new Date(getLockTime()*1000);
} | java | public Date estimateLockTime(AbstractBlockChain chain) {
if (lockTime < LOCKTIME_THRESHOLD)
return chain.estimateBlockTime((int)getLockTime());
else
return new Date(getLockTime()*1000);
} | [
"public",
"Date",
"estimateLockTime",
"(",
"AbstractBlockChain",
"chain",
")",
"{",
"if",
"(",
"lockTime",
"<",
"LOCKTIME_THRESHOLD",
")",
"return",
"chain",
".",
"estimateBlockTime",
"(",
"(",
"int",
")",
"getLockTime",
"(",
")",
")",
";",
"else",
"return",
... | 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. | [
"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",
"b... | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Transaction.java#L1749-L1754 |
23,431 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/protocols/channels/StoredPaymentChannelClientStates.java | StoredPaymentChannelClientStates.getBalanceForServer | public Coin getBalanceForServer(Sha256Hash id) {
Coin balance = Coin.ZERO;
lock.lock();
try {
Set<StoredClientChannel> setChannels = mapChannels.get(id);
for (StoredClientChannel channel : setChannels) {
synchronized (channel) {
if (cha... | java | public Coin getBalanceForServer(Sha256Hash id) {
Coin balance = Coin.ZERO;
lock.lock();
try {
Set<StoredClientChannel> setChannels = mapChannels.get(id);
for (StoredClientChannel channel : setChannels) {
synchronized (channel) {
if (cha... | [
"public",
"Coin",
"getBalanceForServer",
"(",
"Sha256Hash",
"id",
")",
"{",
"Coin",
"balance",
"=",
"Coin",
".",
"ZERO",
";",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"Set",
"<",
"StoredClientChannel",
">",
"setChannels",
"=",
"mapChannels",
".",
... | Returns the outstanding amount of money sent back to us for all channels to this server added together. | [
"Returns",
"the",
"outstanding",
"amount",
"of",
"money",
"sent",
"back",
"to",
"us",
"for",
"all",
"channels",
"to",
"this",
"server",
"added",
"together",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/protocols/channels/StoredPaymentChannelClientStates.java#L97-L112 |
23,432 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/protocols/channels/StoredPaymentChannelClientStates.java | StoredPaymentChannelClientStates.getSecondsUntilExpiry | public long getSecondsUntilExpiry(Sha256Hash id) {
lock.lock();
try {
final Set<StoredClientChannel> setChannels = mapChannels.get(id);
final long nowSeconds = Utils.currentTimeSeconds();
int earliestTime = Integer.MAX_VALUE;
for (StoredClientChannel chann... | java | public long getSecondsUntilExpiry(Sha256Hash id) {
lock.lock();
try {
final Set<StoredClientChannel> setChannels = mapChannels.get(id);
final long nowSeconds = Utils.currentTimeSeconds();
int earliestTime = Integer.MAX_VALUE;
for (StoredClientChannel chann... | [
"public",
"long",
"getSecondsUntilExpiry",
"(",
"Sha256Hash",
"id",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"final",
"Set",
"<",
"StoredClientChannel",
">",
"setChannels",
"=",
"mapChannels",
".",
"get",
"(",
"id",
")",
";",
"final",
"l... | Returns the number of seconds from now until this servers next channel will expire, or zero if no unexpired
channels found. | [
"Returns",
"the",
"number",
"of",
"seconds",
"from",
"now",
"until",
"this",
"servers",
"next",
"channel",
"will",
"expire",
"or",
"zero",
"if",
"no",
"unexpired",
"channels",
"found",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/protocols/channels/StoredPaymentChannelClientStates.java#L118-L134 |
23,433 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/protocols/channels/StoredPaymentChannelClientStates.java | StoredPaymentChannelClientStates.getChannel | @Nullable
public StoredClientChannel getChannel(Sha256Hash id, Sha256Hash contractHash) {
lock.lock();
try {
Set<StoredClientChannel> setChannels = mapChannels.get(id);
for (StoredClientChannel channel : setChannels) {
if (channel.contract.getTxId().equals(con... | java | @Nullable
public StoredClientChannel getChannel(Sha256Hash id, Sha256Hash contractHash) {
lock.lock();
try {
Set<StoredClientChannel> setChannels = mapChannels.get(id);
for (StoredClientChannel channel : setChannels) {
if (channel.contract.getTxId().equals(con... | [
"@",
"Nullable",
"public",
"StoredClientChannel",
"getChannel",
"(",
"Sha256Hash",
"id",
",",
"Sha256Hash",
"contractHash",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"Set",
"<",
"StoredClientChannel",
">",
"setChannels",
"=",
"mapChannels",
"."... | Finds a channel with the given id and contract hash and returns it, or returns null. | [
"Finds",
"a",
"channel",
"with",
"the",
"given",
"id",
"and",
"contract",
"hash",
"and",
"returns",
"it",
"or",
"returns",
"null",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/protocols/channels/StoredPaymentChannelClientStates.java#L169-L182 |
23,434 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/protocols/channels/StoredPaymentChannelClientStates.java | StoredPaymentChannelClientStates.getAnnouncePeerGroup | private TransactionBroadcaster getAnnouncePeerGroup() {
try {
return announcePeerGroupFuture.get(MAX_SECONDS_TO_WAIT_FOR_BROADCASTER_TO_BE_SET, TimeUnit.SECONDS);
} catch (InterruptedException e) {
throw new RuntimeException(e);
} catch (ExecutionException e) {
... | java | private TransactionBroadcaster getAnnouncePeerGroup() {
try {
return announcePeerGroupFuture.get(MAX_SECONDS_TO_WAIT_FOR_BROADCASTER_TO_BE_SET, TimeUnit.SECONDS);
} catch (InterruptedException e) {
throw new RuntimeException(e);
} catch (ExecutionException e) {
... | [
"private",
"TransactionBroadcaster",
"getAnnouncePeerGroup",
"(",
")",
"{",
"try",
"{",
"return",
"announcePeerGroupFuture",
".",
"get",
"(",
"MAX_SECONDS_TO_WAIT_FOR_BROADCASTER_TO_BE_SET",
",",
"TimeUnit",
".",
"SECONDS",
")",
";",
"}",
"catch",
"(",
"InterruptedExcep... | If the peer group has not been set for MAX_SECONDS_TO_WAIT_FOR_BROADCASTER_TO_BE_SET seconds, then
the programmer probably forgot to set it and we should throw exception. | [
"If",
"the",
"peer",
"group",
"has",
"not",
"been",
"set",
"for",
"MAX_SECONDS_TO_WAIT_FOR_BROADCASTER_TO_BE_SET",
"seconds",
"then",
"the",
"programmer",
"probably",
"forgot",
"to",
"set",
"it",
"and",
"we",
"should",
"throw",
"exception",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/protocols/channels/StoredPaymentChannelClientStates.java#L245-L257 |
23,435 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/wallet/WalletFiles.java | WalletFiles.saveNow | public void saveNow() throws IOException {
// Can be called by any thread. However the wallet is locked whilst saving, so we can have two saves in flight
// but they will serialize (using different temp files).
if (executor.isShutdown())
return;
Date lastBlockSeenTime = walle... | java | public void saveNow() throws IOException {
// Can be called by any thread. However the wallet is locked whilst saving, so we can have two saves in flight
// but they will serialize (using different temp files).
if (executor.isShutdown())
return;
Date lastBlockSeenTime = walle... | [
"public",
"void",
"saveNow",
"(",
")",
"throws",
"IOException",
"{",
"// Can be called by any thread. However the wallet is locked whilst saving, so we can have two saves in flight",
"// but they will serialize (using different temp files).",
"if",
"(",
"executor",
".",
"isShutdown",
"... | Actually write the wallet file to disk, using an atomic rename when possible. Runs on the current thread. | [
"Actually",
"write",
"the",
"wallet",
"file",
"to",
"disk",
"using",
"an",
"atomic",
"rename",
"when",
"possible",
".",
"Runs",
"on",
"the",
"current",
"thread",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/wallet/WalletFiles.java#L118-L128 |
23,436 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/wallet/WalletFiles.java | WalletFiles.saveLater | public void saveLater() {
if (executor.isShutdown() || savePending.getAndSet(true))
return; // Already pending.
executor.schedule(saver, delay, delayTimeUnit);
} | java | public void saveLater() {
if (executor.isShutdown() || savePending.getAndSet(true))
return; // Already pending.
executor.schedule(saver, delay, delayTimeUnit);
} | [
"public",
"void",
"saveLater",
"(",
")",
"{",
"if",
"(",
"executor",
".",
"isShutdown",
"(",
")",
"||",
"savePending",
".",
"getAndSet",
"(",
"true",
")",
")",
"return",
";",
"// Already pending.",
"executor",
".",
"schedule",
"(",
"saver",
",",
"delay",
... | Queues up a save in the background. Useful for not very important wallet changes. | [
"Queues",
"up",
"a",
"save",
"in",
"the",
"background",
".",
"Useful",
"for",
"not",
"very",
"important",
"wallet",
"changes",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/wallet/WalletFiles.java#L145-L149 |
23,437 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/wallet/WalletFiles.java | WalletFiles.shutdownAndWait | public void shutdownAndWait() {
executor.shutdown();
try {
executor.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS); // forever
} catch (InterruptedException x) {
throw new RuntimeException(x);
}
} | java | public void shutdownAndWait() {
executor.shutdown();
try {
executor.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS); // forever
} catch (InterruptedException x) {
throw new RuntimeException(x);
}
} | [
"public",
"void",
"shutdownAndWait",
"(",
")",
"{",
"executor",
".",
"shutdown",
"(",
")",
";",
"try",
"{",
"executor",
".",
"awaitTermination",
"(",
"Long",
".",
"MAX_VALUE",
",",
"TimeUnit",
".",
"DAYS",
")",
";",
"// forever",
"}",
"catch",
"(",
"Inte... | Shut down auto-saving. | [
"Shut",
"down",
"auto",
"-",
"saving",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/wallet/WalletFiles.java#L152-L159 |
23,438 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/wallet/KeyChainGroup.java | KeyChainGroup.createBasic | public static KeyChainGroup createBasic(NetworkParameters params) {
return new KeyChainGroup(params, new BasicKeyChain(), null, -1, -1, null, null);
} | java | public static KeyChainGroup createBasic(NetworkParameters params) {
return new KeyChainGroup(params, new BasicKeyChain(), null, -1, -1, null, null);
} | [
"public",
"static",
"KeyChainGroup",
"createBasic",
"(",
"NetworkParameters",
"params",
")",
"{",
"return",
"new",
"KeyChainGroup",
"(",
"params",
",",
"new",
"BasicKeyChain",
"(",
")",
",",
"null",
",",
"-",
"1",
",",
"-",
"1",
",",
"null",
",",
"null",
... | Creates a keychain group with just a basic chain. No deterministic chains will be created automatically. | [
"Creates",
"a",
"keychain",
"group",
"with",
"just",
"a",
"basic",
"chain",
".",
"No",
"deterministic",
"chains",
"will",
"be",
"created",
"automatically",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/wallet/KeyChainGroup.java#L198-L200 |
23,439 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/wallet/KeyChainGroup.java | KeyChainGroup.mergeActiveKeyChains | public final void mergeActiveKeyChains(KeyChainGroup from, long keyRotationTimeSecs) {
checkArgument(isEncrypted() == from.isEncrypted(), "encrypted and non-encrypted keychains cannot be mixed");
for (DeterministicKeyChain chain : from.getActiveKeyChains(keyRotationTimeSecs))
addAndActivateH... | java | public final void mergeActiveKeyChains(KeyChainGroup from, long keyRotationTimeSecs) {
checkArgument(isEncrypted() == from.isEncrypted(), "encrypted and non-encrypted keychains cannot be mixed");
for (DeterministicKeyChain chain : from.getActiveKeyChains(keyRotationTimeSecs))
addAndActivateH... | [
"public",
"final",
"void",
"mergeActiveKeyChains",
"(",
"KeyChainGroup",
"from",
",",
"long",
"keyRotationTimeSecs",
")",
"{",
"checkArgument",
"(",
"isEncrypted",
"(",
")",
"==",
"from",
".",
"isEncrypted",
"(",
")",
",",
"\"encrypted and non-encrypted keychains cann... | Merge all active chains from the given keychain group into this keychain group. | [
"Merge",
"all",
"active",
"chains",
"from",
"the",
"given",
"keychain",
"group",
"into",
"this",
"keychain",
"group",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/wallet/KeyChainGroup.java#L435-L439 |
23,440 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/wallet/KeyChainGroup.java | KeyChainGroup.importKeysAndEncrypt | public int importKeysAndEncrypt(final List<ECKey> keys, KeyParameter aesKey) {
// TODO: Firstly check if the aes key can decrypt any of the existing keys successfully.
checkState(keyCrypter != null, "Not encrypted");
LinkedList<ECKey> encryptedKeys = Lists.newLinkedList();
for (ECKey key... | java | public int importKeysAndEncrypt(final List<ECKey> keys, KeyParameter aesKey) {
// TODO: Firstly check if the aes key can decrypt any of the existing keys successfully.
checkState(keyCrypter != null, "Not encrypted");
LinkedList<ECKey> encryptedKeys = Lists.newLinkedList();
for (ECKey key... | [
"public",
"int",
"importKeysAndEncrypt",
"(",
"final",
"List",
"<",
"ECKey",
">",
"keys",
",",
"KeyParameter",
"aesKey",
")",
"{",
"// TODO: Firstly check if the aes key can decrypt any of the existing keys successfully.",
"checkState",
"(",
"keyCrypter",
"!=",
"null",
",",... | Imports the given unencrypted keys into the basic chain, encrypting them along the way with the given key. | [
"Imports",
"the",
"given",
"unencrypted",
"keys",
"into",
"the",
"basic",
"chain",
"encrypting",
"them",
"along",
"the",
"way",
"with",
"the",
"given",
"key",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/wallet/KeyChainGroup.java#L490-L500 |
23,441 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/wallet/KeyChainGroup.java | KeyChainGroup.maybeMarkCurrentAddressAsUsed | private void maybeMarkCurrentAddressAsUsed(LegacyAddress address) {
checkArgument(address.getOutputScriptType() == ScriptType.P2SH);
for (Map.Entry<KeyChain.KeyPurpose, Address> entry : currentAddresses.entrySet()) {
if (entry.getValue() != null && entry.getValue().equals(address)) {
... | java | private void maybeMarkCurrentAddressAsUsed(LegacyAddress address) {
checkArgument(address.getOutputScriptType() == ScriptType.P2SH);
for (Map.Entry<KeyChain.KeyPurpose, Address> entry : currentAddresses.entrySet()) {
if (entry.getValue() != null && entry.getValue().equals(address)) {
... | [
"private",
"void",
"maybeMarkCurrentAddressAsUsed",
"(",
"LegacyAddress",
"address",
")",
"{",
"checkArgument",
"(",
"address",
".",
"getOutputScriptType",
"(",
")",
"==",
"ScriptType",
".",
"P2SH",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"KeyChain",
"... | If the given P2SH address is "current", advance it to a new one. | [
"If",
"the",
"given",
"P2SH",
"address",
"is",
"current",
"advance",
"it",
"to",
"a",
"new",
"one",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/wallet/KeyChainGroup.java#L568-L577 |
23,442 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/wallet/KeyChainGroup.java | KeyChainGroup.maybeMarkCurrentKeyAsUsed | private void maybeMarkCurrentKeyAsUsed(DeterministicKey key) {
// It's OK for currentKeys to be empty here: it means we're a married wallet and the key may be a part of a
// rotating chain.
for (Map.Entry<KeyChain.KeyPurpose, DeterministicKey> entry : currentKeys.entrySet()) {
if (en... | java | private void maybeMarkCurrentKeyAsUsed(DeterministicKey key) {
// It's OK for currentKeys to be empty here: it means we're a married wallet and the key may be a part of a
// rotating chain.
for (Map.Entry<KeyChain.KeyPurpose, DeterministicKey> entry : currentKeys.entrySet()) {
if (en... | [
"private",
"void",
"maybeMarkCurrentKeyAsUsed",
"(",
"DeterministicKey",
"key",
")",
"{",
"// It's OK for currentKeys to be empty here: it means we're a married wallet and the key may be a part of a",
"// rotating chain.",
"for",
"(",
"Map",
".",
"Entry",
"<",
"KeyChain",
".",
"K... | If the given key is "current", advance the current key to a new one. | [
"If",
"the",
"given",
"key",
"is",
"current",
"advance",
"the",
"current",
"key",
"to",
"a",
"new",
"one",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/wallet/KeyChainGroup.java#L580-L590 |
23,443 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/wallet/KeyChainGroup.java | KeyChainGroup.numKeys | public int numKeys() {
int result = basic.numKeys();
if (chains != null)
for (DeterministicKeyChain chain : chains)
result += chain.numKeys();
return result;
} | java | public int numKeys() {
int result = basic.numKeys();
if (chains != null)
for (DeterministicKeyChain chain : chains)
result += chain.numKeys();
return result;
} | [
"public",
"int",
"numKeys",
"(",
")",
"{",
"int",
"result",
"=",
"basic",
".",
"numKeys",
"(",
")",
";",
"if",
"(",
"chains",
"!=",
"null",
")",
"for",
"(",
"DeterministicKeyChain",
"chain",
":",
"chains",
")",
"result",
"+=",
"chain",
".",
"numKeys",
... | Returns the number of keys managed by this group, including the lookahead buffers. | [
"Returns",
"the",
"number",
"of",
"keys",
"managed",
"by",
"this",
"group",
"including",
"the",
"lookahead",
"buffers",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/wallet/KeyChainGroup.java#L632-L638 |
23,444 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/wallet/KeyChainGroup.java | KeyChainGroup.removeImportedKey | public boolean removeImportedKey(ECKey key) {
checkNotNull(key);
checkArgument(!(key instanceof DeterministicKey));
return basic.removeKey(key);
} | java | public boolean removeImportedKey(ECKey key) {
checkNotNull(key);
checkArgument(!(key instanceof DeterministicKey));
return basic.removeKey(key);
} | [
"public",
"boolean",
"removeImportedKey",
"(",
"ECKey",
"key",
")",
"{",
"checkNotNull",
"(",
"key",
")",
";",
"checkArgument",
"(",
"!",
"(",
"key",
"instanceof",
"DeterministicKey",
")",
")",
";",
"return",
"basic",
".",
"removeKey",
"(",
"key",
")",
";"... | Removes a key that was imported into the basic key chain. You cannot remove deterministic keys.
@throws java.lang.IllegalArgumentException if the key is deterministic. | [
"Removes",
"a",
"key",
"that",
"was",
"imported",
"into",
"the",
"basic",
"key",
"chain",
".",
"You",
"cannot",
"remove",
"deterministic",
"keys",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/wallet/KeyChainGroup.java#L644-L648 |
23,445 | bitcoinj/bitcoinj | wallettemplate/src/main/java/wallettemplate/WalletPasswordController.java | WalletPasswordController.setTargetTime | public static void setTargetTime(Duration targetTime) {
ByteString bytes = ByteString.copyFrom(Longs.toByteArray(targetTime.toMillis()));
Main.bitcoin.wallet().setTag(TAG, bytes);
} | java | public static void setTargetTime(Duration targetTime) {
ByteString bytes = ByteString.copyFrom(Longs.toByteArray(targetTime.toMillis()));
Main.bitcoin.wallet().setTag(TAG, bytes);
} | [
"public",
"static",
"void",
"setTargetTime",
"(",
"Duration",
"targetTime",
")",
"{",
"ByteString",
"bytes",
"=",
"ByteString",
".",
"copyFrom",
"(",
"Longs",
".",
"toByteArray",
"(",
"targetTime",
".",
"toMillis",
"(",
")",
")",
")",
";",
"Main",
".",
"bi... | Writes the given time to the wallet as a tag so we can find it again in this class. | [
"Writes",
"the",
"given",
"time",
"to",
"the",
"wallet",
"as",
"a",
"tag",
"so",
"we",
"can",
"find",
"it",
"again",
"in",
"this",
"class",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/wallettemplate/src/main/java/wallettemplate/WalletPasswordController.java#L114-L117 |
23,446 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/crypto/DeterministicKey.java | DeterministicKey.ascertainParentFingerprint | private int ascertainParentFingerprint(DeterministicKey parentKey, int parentFingerprint)
throws IllegalArgumentException {
if (parentFingerprint != 0) {
if (parent != null)
checkArgument(parent.getFingerprint() == parentFingerprint,
"parent fingerpr... | java | private int ascertainParentFingerprint(DeterministicKey parentKey, int parentFingerprint)
throws IllegalArgumentException {
if (parentFingerprint != 0) {
if (parent != null)
checkArgument(parent.getFingerprint() == parentFingerprint,
"parent fingerpr... | [
"private",
"int",
"ascertainParentFingerprint",
"(",
"DeterministicKey",
"parentKey",
",",
"int",
"parentFingerprint",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"parentFingerprint",
"!=",
"0",
")",
"{",
"if",
"(",
"parent",
"!=",
"null",
")",
"che... | Return the fingerprint of this key's parent as an int value, or zero if this key is the
root node of the key hierarchy. Raise an exception if the arguments are inconsistent.
This method exists to avoid code repetition in the constructors. | [
"Return",
"the",
"fingerprint",
"of",
"this",
"key",
"s",
"parent",
"as",
"an",
"int",
"value",
"or",
"zero",
"if",
"this",
"key",
"is",
"the",
"root",
"node",
"of",
"the",
"key",
"hierarchy",
".",
"Raise",
"an",
"exception",
"if",
"the",
"arguments",
... | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/crypto/DeterministicKey.java#L118-L127 |
23,447 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/crypto/DeterministicKey.java | DeterministicKey.getPrivKeyBytes33 | public byte[] getPrivKeyBytes33() {
byte[] bytes33 = new byte[33];
byte[] priv = getPrivKeyBytes();
System.arraycopy(priv, 0, bytes33, 33 - priv.length, priv.length);
return bytes33;
} | java | public byte[] getPrivKeyBytes33() {
byte[] bytes33 = new byte[33];
byte[] priv = getPrivKeyBytes();
System.arraycopy(priv, 0, bytes33, 33 - priv.length, priv.length);
return bytes33;
} | [
"public",
"byte",
"[",
"]",
"getPrivKeyBytes33",
"(",
")",
"{",
"byte",
"[",
"]",
"bytes33",
"=",
"new",
"byte",
"[",
"33",
"]",
";",
"byte",
"[",
"]",
"priv",
"=",
"getPrivKeyBytes",
"(",
")",
";",
"System",
".",
"arraycopy",
"(",
"priv",
",",
"0"... | Returns private key bytes, padded with zeros to 33 bytes.
@throws java.lang.IllegalStateException if the private key bytes are missing. | [
"Returns",
"private",
"key",
"bytes",
"padded",
"with",
"zeros",
"to",
"33",
"bytes",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/crypto/DeterministicKey.java#L248-L253 |
23,448 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/crypto/DeterministicKey.java | DeterministicKey.findOrDeriveEncryptedPrivateKey | private BigInteger findOrDeriveEncryptedPrivateKey(KeyCrypter keyCrypter, KeyParameter aesKey) {
if (encryptedPrivateKey != null) {
byte[] decryptedKey = keyCrypter.decrypt(encryptedPrivateKey, aesKey);
if (decryptedKey.length != 32)
throw new KeyCrypterException.InvalidC... | java | private BigInteger findOrDeriveEncryptedPrivateKey(KeyCrypter keyCrypter, KeyParameter aesKey) {
if (encryptedPrivateKey != null) {
byte[] decryptedKey = keyCrypter.decrypt(encryptedPrivateKey, aesKey);
if (decryptedKey.length != 32)
throw new KeyCrypterException.InvalidC... | [
"private",
"BigInteger",
"findOrDeriveEncryptedPrivateKey",
"(",
"KeyCrypter",
"keyCrypter",
",",
"KeyParameter",
"aesKey",
")",
"{",
"if",
"(",
"encryptedPrivateKey",
"!=",
"null",
")",
"{",
"byte",
"[",
"]",
"decryptedKey",
"=",
"keyCrypter",
".",
"decrypt",
"("... | to decrypt and re-derive. | [
"to",
"decrypt",
"and",
"re",
"-",
"derive",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/crypto/DeterministicKey.java#L393-L415 |
23,449 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/crypto/DeterministicKey.java | DeterministicKey.getPrivKey | @Override
public BigInteger getPrivKey() {
final BigInteger key = findOrDerivePrivateKey();
checkState(key != null, "Private key bytes not available");
return key;
} | java | @Override
public BigInteger getPrivKey() {
final BigInteger key = findOrDerivePrivateKey();
checkState(key != null, "Private key bytes not available");
return key;
} | [
"@",
"Override",
"public",
"BigInteger",
"getPrivKey",
"(",
")",
"{",
"final",
"BigInteger",
"key",
"=",
"findOrDerivePrivateKey",
"(",
")",
";",
"checkState",
"(",
"key",
"!=",
"null",
",",
"\"Private key bytes not available\"",
")",
";",
"return",
"key",
";",
... | Returns the private key of this deterministic key. Even if this object isn't storing the private key,
it can be re-derived by walking up to the parents if necessary and this is what will happen.
@throws java.lang.IllegalStateException if the parents are encrypted or a watching chain. | [
"Returns",
"the",
"private",
"key",
"of",
"this",
"deterministic",
"key",
".",
"Even",
"if",
"this",
"object",
"isn",
"t",
"storing",
"the",
"private",
"key",
"it",
"can",
"be",
"re",
"-",
"derived",
"by",
"walking",
"up",
"to",
"the",
"parents",
"if",
... | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/crypto/DeterministicKey.java#L465-L470 |
23,450 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/crypto/DeterministicKey.java | DeterministicKey.deserializeB58 | public static DeterministicKey deserializeB58(String base58, NetworkParameters params) {
return deserializeB58(null, base58, params);
} | java | public static DeterministicKey deserializeB58(String base58, NetworkParameters params) {
return deserializeB58(null, base58, params);
} | [
"public",
"static",
"DeterministicKey",
"deserializeB58",
"(",
"String",
"base58",
",",
"NetworkParameters",
"params",
")",
"{",
"return",
"deserializeB58",
"(",
"null",
",",
"base58",
",",
"params",
")",
";",
"}"
] | Deserialize a base-58-encoded HD Key with no parent | [
"Deserialize",
"a",
"base",
"-",
"58",
"-",
"encoded",
"HD",
"Key",
"with",
"no",
"parent"
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/crypto/DeterministicKey.java#L520-L522 |
23,451 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/utils/BlockFileLoader.java | BlockFileLoader.getReferenceClientBlockFileList | public static List<File> getReferenceClientBlockFileList(File blocksDir) {
checkArgument(blocksDir.isDirectory(), "%s is not a directory", blocksDir);
List<File> list = new LinkedList<>();
for (int i = 0; true; i++) {
File file = new File(blocksDir, String.format(Locale.US, "blk%05d.... | java | public static List<File> getReferenceClientBlockFileList(File blocksDir) {
checkArgument(blocksDir.isDirectory(), "%s is not a directory", blocksDir);
List<File> list = new LinkedList<>();
for (int i = 0; true; i++) {
File file = new File(blocksDir, String.format(Locale.US, "blk%05d.... | [
"public",
"static",
"List",
"<",
"File",
">",
"getReferenceClientBlockFileList",
"(",
"File",
"blocksDir",
")",
"{",
"checkArgument",
"(",
"blocksDir",
".",
"isDirectory",
"(",
")",
",",
"\"%s is not a directory\"",
",",
"blocksDir",
")",
";",
"List",
"<",
"File... | Gets the list of files which contain blocks from Bitcoin Core. | [
"Gets",
"the",
"list",
"of",
"files",
"which",
"contain",
"blocks",
"from",
"Bitcoin",
"Core",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/utils/BlockFileLoader.java#L57-L67 |
23,452 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/protocols/channels/StateMachine.java | StateMachine.checkState | public synchronized void checkState(State requiredState) throws IllegalStateException {
if (requiredState != currentState) {
throw new IllegalStateException(String.format(Locale.US,
"Expected state %s, but in state %s", requiredState, currentState));
}
} | java | public synchronized void checkState(State requiredState) throws IllegalStateException {
if (requiredState != currentState) {
throw new IllegalStateException(String.format(Locale.US,
"Expected state %s, but in state %s", requiredState, currentState));
}
} | [
"public",
"synchronized",
"void",
"checkState",
"(",
"State",
"requiredState",
")",
"throws",
"IllegalStateException",
"{",
"if",
"(",
"requiredState",
"!=",
"currentState",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"String",
".",
"format",
"(",
"Loc... | Checks that the machine is in the given state. Throws if it isn't.
@param requiredState | [
"Checks",
"that",
"the",
"machine",
"is",
"in",
"the",
"given",
"state",
".",
"Throws",
"if",
"it",
"isn",
"t",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/protocols/channels/StateMachine.java#L44-L49 |
23,453 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/protocols/channels/StateMachine.java | StateMachine.checkState | public synchronized void checkState(State... requiredStates) throws IllegalStateException {
for (State requiredState : requiredStates) {
if (requiredState.equals(currentState)) {
return;
}
}
throw new IllegalStateException(String.format(Locale.US,
... | java | public synchronized void checkState(State... requiredStates) throws IllegalStateException {
for (State requiredState : requiredStates) {
if (requiredState.equals(currentState)) {
return;
}
}
throw new IllegalStateException(String.format(Locale.US,
... | [
"public",
"synchronized",
"void",
"checkState",
"(",
"State",
"...",
"requiredStates",
")",
"throws",
"IllegalStateException",
"{",
"for",
"(",
"State",
"requiredState",
":",
"requiredStates",
")",
"{",
"if",
"(",
"requiredState",
".",
"equals",
"(",
"currentState... | Checks that the machine is in one of the given states. Throws if it isn't.
@param requiredStates | [
"Checks",
"that",
"the",
"machine",
"is",
"in",
"one",
"of",
"the",
"given",
"states",
".",
"Throws",
"if",
"it",
"isn",
"t",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/protocols/channels/StateMachine.java#L55-L63 |
23,454 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/protocols/channels/StateMachine.java | StateMachine.transition | public synchronized void transition(State newState) throws IllegalStateException {
if (transitions.containsEntry(currentState, newState)) {
currentState = newState;
} else {
throw new IllegalStateException(String.format(Locale.US,
"Attempted invalid transition... | java | public synchronized void transition(State newState) throws IllegalStateException {
if (transitions.containsEntry(currentState, newState)) {
currentState = newState;
} else {
throw new IllegalStateException(String.format(Locale.US,
"Attempted invalid transition... | [
"public",
"synchronized",
"void",
"transition",
"(",
"State",
"newState",
")",
"throws",
"IllegalStateException",
"{",
"if",
"(",
"transitions",
".",
"containsEntry",
"(",
"currentState",
",",
"newState",
")",
")",
"{",
"currentState",
"=",
"newState",
";",
"}",... | Transitions to a new state, provided that the required transition exists
@param newState
@throws IllegalStateException If no state transition exists from oldState to newState | [
"Transitions",
"to",
"a",
"new",
"state",
"provided",
"that",
"the",
"required",
"transition",
"exists"
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/protocols/channels/StateMachine.java#L70-L77 |
23,455 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/BloomFilter.java | BloomFilter.getFalsePositiveRate | public double getFalsePositiveRate(int elements) {
return pow(1 - pow(E, -1.0 * (hashFuncs * elements) / (data.length * 8)), hashFuncs);
} | java | public double getFalsePositiveRate(int elements) {
return pow(1 - pow(E, -1.0 * (hashFuncs * elements) / (data.length * 8)), hashFuncs);
} | [
"public",
"double",
"getFalsePositiveRate",
"(",
"int",
"elements",
")",
"{",
"return",
"pow",
"(",
"1",
"-",
"pow",
"(",
"E",
",",
"-",
"1.0",
"*",
"(",
"hashFuncs",
"*",
"elements",
")",
"/",
"(",
"data",
".",
"length",
"*",
"8",
")",
")",
",",
... | Returns the theoretical false positive rate of this filter if were to contain the given number of elements. | [
"Returns",
"the",
"theoretical",
"false",
"positive",
"rate",
"of",
"this",
"filter",
"if",
"were",
"to",
"contain",
"the",
"given",
"number",
"of",
"elements",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/BloomFilter.java#L129-L131 |
23,456 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/BloomFilter.java | BloomFilter.contains | public synchronized boolean contains(byte[] object) {
for (int i = 0; i < hashFuncs; i++) {
if (!Utils.checkBitLE(data, murmurHash3(data, nTweak, i, object)))
return false;
}
return true;
} | java | public synchronized boolean contains(byte[] object) {
for (int i = 0; i < hashFuncs; i++) {
if (!Utils.checkBitLE(data, murmurHash3(data, nTweak, i, object)))
return false;
}
return true;
} | [
"public",
"synchronized",
"boolean",
"contains",
"(",
"byte",
"[",
"]",
"object",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"hashFuncs",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"Utils",
".",
"checkBitLE",
"(",
"data",
",",
"mur... | Returns true if the given object matches the filter either because it was inserted, or because we have a
false-positive. | [
"Returns",
"true",
"if",
"the",
"given",
"object",
"matches",
"the",
"filter",
"either",
"because",
"it",
"was",
"inserted",
"or",
"because",
"we",
"have",
"a",
"false",
"-",
"positive",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/BloomFilter.java#L230-L236 |
23,457 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/BloomFilter.java | BloomFilter.insert | public synchronized void insert(byte[] object) {
for (int i = 0; i < hashFuncs; i++)
Utils.setBitLE(data, murmurHash3(data, nTweak, i, object));
} | java | public synchronized void insert(byte[] object) {
for (int i = 0; i < hashFuncs; i++)
Utils.setBitLE(data, murmurHash3(data, nTweak, i, object));
} | [
"public",
"synchronized",
"void",
"insert",
"(",
"byte",
"[",
"]",
"object",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"hashFuncs",
";",
"i",
"++",
")",
"Utils",
".",
"setBitLE",
"(",
"data",
",",
"murmurHash3",
"(",
"data",
",",
... | Insert the given arbitrary data into the filter | [
"Insert",
"the",
"given",
"arbitrary",
"data",
"into",
"the",
"filter"
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/BloomFilter.java#L239-L242 |
23,458 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/BloomFilter.java | BloomFilter.merge | public synchronized void merge(BloomFilter filter) {
if (!this.matchesAll() && !filter.matchesAll()) {
checkArgument(filter.data.length == this.data.length &&
filter.hashFuncs == this.hashFuncs &&
filter.nTweak == this.nTweak);
for (int... | java | public synchronized void merge(BloomFilter filter) {
if (!this.matchesAll() && !filter.matchesAll()) {
checkArgument(filter.data.length == this.data.length &&
filter.hashFuncs == this.hashFuncs &&
filter.nTweak == this.nTweak);
for (int... | [
"public",
"synchronized",
"void",
"merge",
"(",
"BloomFilter",
"filter",
")",
"{",
"if",
"(",
"!",
"this",
".",
"matchesAll",
"(",
")",
"&&",
"!",
"filter",
".",
"matchesAll",
"(",
")",
")",
"{",
"checkArgument",
"(",
"filter",
".",
"data",
".",
"lengt... | Copies filter into this. Filter must have the same size, hash function count and nTweak or an
IllegalArgumentException will be thrown. | [
"Copies",
"filter",
"into",
"this",
".",
"Filter",
"must",
"have",
"the",
"same",
"size",
"hash",
"function",
"count",
"and",
"nTweak",
"or",
"an",
"IllegalArgumentException",
"will",
"be",
"thrown",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/BloomFilter.java#L270-L280 |
23,459 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/BloomFilter.java | BloomFilter.getUpdateFlag | public synchronized BloomUpdate getUpdateFlag() {
if (nFlags == 0)
return BloomUpdate.UPDATE_NONE;
else if (nFlags == 1)
return BloomUpdate.UPDATE_ALL;
else if (nFlags == 2)
return BloomUpdate.UPDATE_P2PUBKEY_ONLY;
else
throw new IllegalSta... | java | public synchronized BloomUpdate getUpdateFlag() {
if (nFlags == 0)
return BloomUpdate.UPDATE_NONE;
else if (nFlags == 1)
return BloomUpdate.UPDATE_ALL;
else if (nFlags == 2)
return BloomUpdate.UPDATE_P2PUBKEY_ONLY;
else
throw new IllegalSta... | [
"public",
"synchronized",
"BloomUpdate",
"getUpdateFlag",
"(",
")",
"{",
"if",
"(",
"nFlags",
"==",
"0",
")",
"return",
"BloomUpdate",
".",
"UPDATE_NONE",
";",
"else",
"if",
"(",
"nFlags",
"==",
"1",
")",
"return",
"BloomUpdate",
".",
"UPDATE_ALL",
";",
"e... | The update flag controls how application of the filter to a block modifies the filter. See the enum javadocs
for information on what occurs and when. | [
"The",
"update",
"flag",
"controls",
"how",
"application",
"of",
"the",
"filter",
"to",
"a",
"block",
"modifies",
"the",
"filter",
".",
"See",
"the",
"enum",
"javadocs",
"for",
"information",
"on",
"what",
"occurs",
"and",
"when",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/BloomFilter.java#L297-L306 |
23,460 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/BloomFilter.java | BloomFilter.applyAndUpdate | public synchronized FilteredBlock applyAndUpdate(Block block) {
List<Transaction> txns = block.getTransactions();
List<Sha256Hash> txHashes = new ArrayList<>(txns.size());
List<Transaction> matched = Lists.newArrayList();
byte[] bits = new byte[(int) Math.ceil(txns.size() / 8.0)];
... | java | public synchronized FilteredBlock applyAndUpdate(Block block) {
List<Transaction> txns = block.getTransactions();
List<Sha256Hash> txHashes = new ArrayList<>(txns.size());
List<Transaction> matched = Lists.newArrayList();
byte[] bits = new byte[(int) Math.ceil(txns.size() / 8.0)];
... | [
"public",
"synchronized",
"FilteredBlock",
"applyAndUpdate",
"(",
"Block",
"block",
")",
"{",
"List",
"<",
"Transaction",
">",
"txns",
"=",
"block",
".",
"getTransactions",
"(",
")",
";",
"List",
"<",
"Sha256Hash",
">",
"txHashes",
"=",
"new",
"ArrayList",
"... | Creates a new FilteredBlock from the given Block, using this filter to select transactions. Matches can cause the
filter to be updated with the matched element, this ensures that when a filter is applied to a block, spends of
matched transactions are also matched. However it means this filter can be mutated by the oper... | [
"Creates",
"a",
"new",
"FilteredBlock",
"from",
"the",
"given",
"Block",
"using",
"this",
"filter",
"to",
"select",
"transactions",
".",
"Matches",
"can",
"cause",
"the",
"filter",
"to",
"be",
"updated",
"with",
"the",
"matched",
"element",
"this",
"ensures",
... | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/BloomFilter.java#L314-L332 |
23,461 | bitcoinj/bitcoinj | wallettemplate/src/main/java/wallettemplate/Main.java | Main.overlayUI | public <T> OverlayUI<T> overlayUI(String name) {
try {
checkGuiThread();
// Load the UI from disk.
URL location = GuiUtils.getResource(name);
FXMLLoader loader = new FXMLLoader(location);
Pane ui = loader.load();
T controller = loader.getCo... | java | public <T> OverlayUI<T> overlayUI(String name) {
try {
checkGuiThread();
// Load the UI from disk.
URL location = GuiUtils.getResource(name);
FXMLLoader loader = new FXMLLoader(location);
Pane ui = loader.load();
T controller = loader.getCo... | [
"public",
"<",
"T",
">",
"OverlayUI",
"<",
"T",
">",
"overlayUI",
"(",
"String",
"name",
")",
"{",
"try",
"{",
"checkGuiThread",
"(",
")",
";",
"// Load the UI from disk.",
"URL",
"location",
"=",
"GuiUtils",
".",
"getResource",
"(",
"name",
")",
";",
"F... | Loads the FXML file with the given name, blurs out the main UI and puts this one on top. | [
"Loads",
"the",
"FXML",
"file",
"with",
"the",
"given",
"name",
"blurs",
"out",
"the",
"main",
"UI",
"and",
"puts",
"this",
"one",
"on",
"top",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/wallettemplate/src/main/java/wallettemplate/Main.java#L226-L247 |
23,462 | bitcoinj/bitcoinj | wallettemplate/src/main/java/wallettemplate/utils/GuiUtils.java | GuiUtils.handleCrashesOnThisThread | public static void handleCrashesOnThisThread() {
Thread.currentThread().setUncaughtExceptionHandler((thread, exception) -> {
GuiUtils.crashAlert(Throwables.getRootCause(exception));
});
} | java | public static void handleCrashesOnThisThread() {
Thread.currentThread().setUncaughtExceptionHandler((thread, exception) -> {
GuiUtils.crashAlert(Throwables.getRootCause(exception));
});
} | [
"public",
"static",
"void",
"handleCrashesOnThisThread",
"(",
")",
"{",
"Thread",
".",
"currentThread",
"(",
")",
".",
"setUncaughtExceptionHandler",
"(",
"(",
"thread",
",",
"exception",
")",
"->",
"{",
"GuiUtils",
".",
"crashAlert",
"(",
"Throwables",
".",
"... | Show a GUI alert box for any unhandled exceptions that propagate out of this thread. | [
"Show",
"a",
"GUI",
"alert",
"box",
"for",
"any",
"unhandled",
"exceptions",
"that",
"propagate",
"out",
"of",
"this",
"thread",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/wallettemplate/src/main/java/wallettemplate/utils/GuiUtils.java#L73-L77 |
23,463 | bitcoinj/bitcoinj | wallettemplate/src/main/java/wallettemplate/utils/GuiUtils.java | GuiUtils.getResource | public static URL getResource(String name) {
if (false)
return unchecked(() -> new URL("file:///your/path/here/src/main/wallettemplate/" + name));
else
return MainController.class.getResource(name);
} | java | public static URL getResource(String name) {
if (false)
return unchecked(() -> new URL("file:///your/path/here/src/main/wallettemplate/" + name));
else
return MainController.class.getResource(name);
} | [
"public",
"static",
"URL",
"getResource",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"false",
")",
"return",
"unchecked",
"(",
"(",
")",
"->",
"new",
"URL",
"(",
"\"file:///your/path/here/src/main/wallettemplate/\"",
"+",
"name",
")",
")",
";",
"else",
"ret... | A useful helper for development purposes. Used as a switch for loading files from local disk, allowing live
editing whilst the app runs without rebuilds. | [
"A",
"useful",
"helper",
"for",
"development",
"purposes",
".",
"Used",
"as",
"a",
"switch",
"for",
"loading",
"files",
"from",
"local",
"disk",
"allowing",
"live",
"editing",
"whilst",
"the",
"app",
"runs",
"without",
"rebuilds",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/wallettemplate/src/main/java/wallettemplate/utils/GuiUtils.java#L177-L182 |
23,464 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/store/LevelDBFullPrunedBlockStore.java | LevelDBFullPrunedBlockStore.dumpStats | void dumpStats() {
long wallTimeNanos = totalStopwatch.elapsed(TimeUnit.NANOSECONDS);
long dbtime = 0;
for (String name : methodCalls.keySet()) {
long calls = methodCalls.get(name);
long time = methodTotalTime.get(name);
dbtime += time;
long averag... | java | void dumpStats() {
long wallTimeNanos = totalStopwatch.elapsed(TimeUnit.NANOSECONDS);
long dbtime = 0;
for (String name : methodCalls.keySet()) {
long calls = methodCalls.get(name);
long time = methodTotalTime.get(name);
dbtime += time;
long averag... | [
"void",
"dumpStats",
"(",
")",
"{",
"long",
"wallTimeNanos",
"=",
"totalStopwatch",
".",
"elapsed",
"(",
"TimeUnit",
".",
"NANOSECONDS",
")",
";",
"long",
"dbtime",
"=",
"0",
";",
"for",
"(",
"String",
"name",
":",
"methodCalls",
".",
"keySet",
"(",
")",... | and cache hit rates etc.. | [
"and",
"cache",
"hit",
"rates",
"etc",
".."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/store/LevelDBFullPrunedBlockStore.java#L365-L386 |
23,465 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/utils/MonetaryFormat.java | MonetaryFormat.negativeSign | public MonetaryFormat negativeSign(char negativeSign) {
checkArgument(!Character.isDigit(negativeSign));
checkArgument(negativeSign > 0);
if (negativeSign == this.negativeSign)
return this;
else
return new MonetaryFormat(negativeSign, positiveSign, zeroDigit, deci... | java | public MonetaryFormat negativeSign(char negativeSign) {
checkArgument(!Character.isDigit(negativeSign));
checkArgument(negativeSign > 0);
if (negativeSign == this.negativeSign)
return this;
else
return new MonetaryFormat(negativeSign, positiveSign, zeroDigit, deci... | [
"public",
"MonetaryFormat",
"negativeSign",
"(",
"char",
"negativeSign",
")",
"{",
"checkArgument",
"(",
"!",
"Character",
".",
"isDigit",
"(",
"negativeSign",
")",
")",
";",
"checkArgument",
"(",
"negativeSign",
">",
"0",
")",
";",
"if",
"(",
"negativeSign",
... | Set character to prefix negative values. | [
"Set",
"character",
"to",
"prefix",
"negative",
"values",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/utils/MonetaryFormat.java#L89-L97 |
23,466 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/utils/MonetaryFormat.java | MonetaryFormat.positiveSign | public MonetaryFormat positiveSign(char positiveSign) {
checkArgument(!Character.isDigit(positiveSign));
if (positiveSign == this.positiveSign)
return this;
else
return new MonetaryFormat(negativeSign, positiveSign, zeroDigit, decimalMark, minDecimals, decimalGroups,
... | java | public MonetaryFormat positiveSign(char positiveSign) {
checkArgument(!Character.isDigit(positiveSign));
if (positiveSign == this.positiveSign)
return this;
else
return new MonetaryFormat(negativeSign, positiveSign, zeroDigit, decimalMark, minDecimals, decimalGroups,
... | [
"public",
"MonetaryFormat",
"positiveSign",
"(",
"char",
"positiveSign",
")",
"{",
"checkArgument",
"(",
"!",
"Character",
".",
"isDigit",
"(",
"positiveSign",
")",
")",
";",
"if",
"(",
"positiveSign",
"==",
"this",
".",
"positiveSign",
")",
"return",
"this",
... | Set character to prefix positive values. A zero value means no sign is used in this case. For parsing, a missing
sign will always be interpreted as if the positive sign was used. | [
"Set",
"character",
"to",
"prefix",
"positive",
"values",
".",
"A",
"zero",
"value",
"means",
"no",
"sign",
"is",
"used",
"in",
"this",
"case",
".",
"For",
"parsing",
"a",
"missing",
"sign",
"will",
"always",
"be",
"interpreted",
"as",
"if",
"the",
"posi... | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/utils/MonetaryFormat.java#L103-L110 |
23,467 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/utils/MonetaryFormat.java | MonetaryFormat.digits | public MonetaryFormat digits(char zeroDigit) {
if (zeroDigit == this.zeroDigit)
return this;
else
return new MonetaryFormat(negativeSign, positiveSign, zeroDigit, decimalMark, minDecimals, decimalGroups,
shift, roundingMode, codes, codeSeparator, codePrefixed)... | java | public MonetaryFormat digits(char zeroDigit) {
if (zeroDigit == this.zeroDigit)
return this;
else
return new MonetaryFormat(negativeSign, positiveSign, zeroDigit, decimalMark, minDecimals, decimalGroups,
shift, roundingMode, codes, codeSeparator, codePrefixed)... | [
"public",
"MonetaryFormat",
"digits",
"(",
"char",
"zeroDigit",
")",
"{",
"if",
"(",
"zeroDigit",
"==",
"this",
".",
"zeroDigit",
")",
"return",
"this",
";",
"else",
"return",
"new",
"MonetaryFormat",
"(",
"negativeSign",
",",
"positiveSign",
",",
"zeroDigit",... | Set character range to use for representing digits. It starts with the specified character representing zero. | [
"Set",
"character",
"range",
"to",
"use",
"for",
"representing",
"digits",
".",
"It",
"starts",
"with",
"the",
"specified",
"character",
"representing",
"zero",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/utils/MonetaryFormat.java#L115-L121 |
23,468 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/utils/MonetaryFormat.java | MonetaryFormat.decimalMark | public MonetaryFormat decimalMark(char decimalMark) {
checkArgument(!Character.isDigit(decimalMark));
checkArgument(decimalMark > 0);
if (decimalMark == this.decimalMark)
return this;
else
return new MonetaryFormat(negativeSign, positiveSign, zeroDigit, decimalMar... | java | public MonetaryFormat decimalMark(char decimalMark) {
checkArgument(!Character.isDigit(decimalMark));
checkArgument(decimalMark > 0);
if (decimalMark == this.decimalMark)
return this;
else
return new MonetaryFormat(negativeSign, positiveSign, zeroDigit, decimalMar... | [
"public",
"MonetaryFormat",
"decimalMark",
"(",
"char",
"decimalMark",
")",
"{",
"checkArgument",
"(",
"!",
"Character",
".",
"isDigit",
"(",
"decimalMark",
")",
")",
";",
"checkArgument",
"(",
"decimalMark",
">",
"0",
")",
";",
"if",
"(",
"decimalMark",
"==... | Set character to use as the decimal mark. If the formatted value does not have any decimals, no decimal mark is
used either. | [
"Set",
"character",
"to",
"use",
"as",
"the",
"decimal",
"mark",
".",
"If",
"the",
"formatted",
"value",
"does",
"not",
"have",
"any",
"decimals",
"no",
"decimal",
"mark",
"is",
"used",
"either",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/utils/MonetaryFormat.java#L127-L135 |
23,469 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/utils/MonetaryFormat.java | MonetaryFormat.shift | public MonetaryFormat shift(int shift) {
if (shift == this.shift)
return this;
else
return new MonetaryFormat(negativeSign, positiveSign, zeroDigit, decimalMark, minDecimals, decimalGroups,
shift, roundingMode, codes, codeSeparator, codePrefixed);
} | java | public MonetaryFormat shift(int shift) {
if (shift == this.shift)
return this;
else
return new MonetaryFormat(negativeSign, positiveSign, zeroDigit, decimalMark, minDecimals, decimalGroups,
shift, roundingMode, codes, codeSeparator, codePrefixed);
} | [
"public",
"MonetaryFormat",
"shift",
"(",
"int",
"shift",
")",
"{",
"if",
"(",
"shift",
"==",
"this",
".",
"shift",
")",
"return",
"this",
";",
"else",
"return",
"new",
"MonetaryFormat",
"(",
"negativeSign",
",",
"positiveSign",
",",
"zeroDigit",
",",
"dec... | Set number of digits to shift the decimal separator to the right, coming from the standard BTC notation that was
common pre-2014. Note this will change the currency code if enabled. | [
"Set",
"number",
"of",
"digits",
"to",
"shift",
"the",
"decimal",
"separator",
"to",
"the",
"right",
"coming",
"from",
"the",
"standard",
"BTC",
"notation",
"that",
"was",
"common",
"pre",
"-",
"2014",
".",
"Note",
"this",
"will",
"change",
"the",
"currenc... | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/utils/MonetaryFormat.java#L204-L210 |
23,470 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/utils/MonetaryFormat.java | MonetaryFormat.roundingMode | public MonetaryFormat roundingMode(RoundingMode roundingMode) {
if (roundingMode == this.roundingMode)
return this;
else
return new MonetaryFormat(negativeSign, positiveSign, zeroDigit, decimalMark, minDecimals, decimalGroups,
shift, roundingMode, codes, codeS... | java | public MonetaryFormat roundingMode(RoundingMode roundingMode) {
if (roundingMode == this.roundingMode)
return this;
else
return new MonetaryFormat(negativeSign, positiveSign, zeroDigit, decimalMark, minDecimals, decimalGroups,
shift, roundingMode, codes, codeS... | [
"public",
"MonetaryFormat",
"roundingMode",
"(",
"RoundingMode",
"roundingMode",
")",
"{",
"if",
"(",
"roundingMode",
"==",
"this",
".",
"roundingMode",
")",
"return",
"this",
";",
"else",
"return",
"new",
"MonetaryFormat",
"(",
"negativeSign",
",",
"positiveSign"... | Set rounding mode to use when it becomes necessary. | [
"Set",
"rounding",
"mode",
"to",
"use",
"when",
"it",
"becomes",
"necessary",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/utils/MonetaryFormat.java#L215-L221 |
23,471 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/utils/MonetaryFormat.java | MonetaryFormat.noCode | public MonetaryFormat noCode() {
if (codes == null)
return this;
else
return new MonetaryFormat(negativeSign, positiveSign, zeroDigit, decimalMark, minDecimals, decimalGroups,
shift, roundingMode, null, codeSeparator, codePrefixed);
} | java | public MonetaryFormat noCode() {
if (codes == null)
return this;
else
return new MonetaryFormat(negativeSign, positiveSign, zeroDigit, decimalMark, minDecimals, decimalGroups,
shift, roundingMode, null, codeSeparator, codePrefixed);
} | [
"public",
"MonetaryFormat",
"noCode",
"(",
")",
"{",
"if",
"(",
"codes",
"==",
"null",
")",
"return",
"this",
";",
"else",
"return",
"new",
"MonetaryFormat",
"(",
"negativeSign",
",",
"positiveSign",
",",
"zeroDigit",
",",
"decimalMark",
",",
"minDecimals",
... | Don't display currency code when formatting. This configuration is not relevant for parsing. | [
"Don",
"t",
"display",
"currency",
"code",
"when",
"formatting",
".",
"This",
"configuration",
"is",
"not",
"relevant",
"for",
"parsing",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/utils/MonetaryFormat.java#L226-L232 |
23,472 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/utils/MonetaryFormat.java | MonetaryFormat.code | public MonetaryFormat code(int codeShift, String code) {
checkArgument(codeShift >= 0);
final String[] codes = null == this.codes
? new String[MAX_DECIMALS]
: Arrays.copyOf(this.codes, this.codes.length);
codes[codeShift] = code;
return new MonetaryFormat(negativ... | java | public MonetaryFormat code(int codeShift, String code) {
checkArgument(codeShift >= 0);
final String[] codes = null == this.codes
? new String[MAX_DECIMALS]
: Arrays.copyOf(this.codes, this.codes.length);
codes[codeShift] = code;
return new MonetaryFormat(negativ... | [
"public",
"MonetaryFormat",
"code",
"(",
"int",
"codeShift",
",",
"String",
"code",
")",
"{",
"checkArgument",
"(",
"codeShift",
">=",
"0",
")",
";",
"final",
"String",
"[",
"]",
"codes",
"=",
"null",
"==",
"this",
".",
"codes",
"?",
"new",
"String",
"... | Configure currency code for given decimal separator shift. This configuration is not relevant for parsing.
@param codeShift
decimal separator shift, see {@link #shift}
@param code
currency code | [
"Configure",
"currency",
"code",
"for",
"given",
"decimal",
"separator",
"shift",
".",
"This",
"configuration",
"is",
"not",
"relevant",
"for",
"parsing",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/utils/MonetaryFormat.java#L242-L251 |
23,473 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/utils/MonetaryFormat.java | MonetaryFormat.codeSeparator | public MonetaryFormat codeSeparator(char codeSeparator) {
checkArgument(!Character.isDigit(codeSeparator));
checkArgument(codeSeparator > 0);
if (codeSeparator == this.codeSeparator)
return this;
else
return new MonetaryFormat(negativeSign, positiveSign, zeroDigit... | java | public MonetaryFormat codeSeparator(char codeSeparator) {
checkArgument(!Character.isDigit(codeSeparator));
checkArgument(codeSeparator > 0);
if (codeSeparator == this.codeSeparator)
return this;
else
return new MonetaryFormat(negativeSign, positiveSign, zeroDigit... | [
"public",
"MonetaryFormat",
"codeSeparator",
"(",
"char",
"codeSeparator",
")",
"{",
"checkArgument",
"(",
"!",
"Character",
".",
"isDigit",
"(",
"codeSeparator",
")",
")",
";",
"checkArgument",
"(",
"codeSeparator",
">",
"0",
")",
";",
"if",
"(",
"codeSeparat... | Separator between currency code and formatted value. This configuration is not relevant for parsing. | [
"Separator",
"between",
"currency",
"code",
"and",
"formatted",
"value",
".",
"This",
"configuration",
"is",
"not",
"relevant",
"for",
"parsing",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/utils/MonetaryFormat.java#L256-L264 |
23,474 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/utils/MonetaryFormat.java | MonetaryFormat.prefixCode | public MonetaryFormat prefixCode() {
if (codePrefixed)
return this;
else
return new MonetaryFormat(negativeSign, positiveSign, zeroDigit, decimalMark, minDecimals, decimalGroups,
shift, roundingMode, codes, codeSeparator, true);
} | java | public MonetaryFormat prefixCode() {
if (codePrefixed)
return this;
else
return new MonetaryFormat(negativeSign, positiveSign, zeroDigit, decimalMark, minDecimals, decimalGroups,
shift, roundingMode, codes, codeSeparator, true);
} | [
"public",
"MonetaryFormat",
"prefixCode",
"(",
")",
"{",
"if",
"(",
"codePrefixed",
")",
"return",
"this",
";",
"else",
"return",
"new",
"MonetaryFormat",
"(",
"negativeSign",
",",
"positiveSign",
",",
"zeroDigit",
",",
"decimalMark",
",",
"minDecimals",
",",
... | Prefix formatted output by currency code. This configuration is not relevant for parsing. | [
"Prefix",
"formatted",
"output",
"by",
"currency",
"code",
".",
"This",
"configuration",
"is",
"not",
"relevant",
"for",
"parsing",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/utils/MonetaryFormat.java#L269-L275 |
23,475 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/utils/MonetaryFormat.java | MonetaryFormat.postfixCode | public MonetaryFormat postfixCode() {
if (!codePrefixed)
return this;
else
return new MonetaryFormat(negativeSign, positiveSign, zeroDigit, decimalMark, minDecimals, decimalGroups,
shift, roundingMode, codes, codeSeparator, false);
} | java | public MonetaryFormat postfixCode() {
if (!codePrefixed)
return this;
else
return new MonetaryFormat(negativeSign, positiveSign, zeroDigit, decimalMark, minDecimals, decimalGroups,
shift, roundingMode, codes, codeSeparator, false);
} | [
"public",
"MonetaryFormat",
"postfixCode",
"(",
")",
"{",
"if",
"(",
"!",
"codePrefixed",
")",
"return",
"this",
";",
"else",
"return",
"new",
"MonetaryFormat",
"(",
"negativeSign",
",",
"positiveSign",
",",
"zeroDigit",
",",
"decimalMark",
",",
"minDecimals",
... | Postfix formatted output with currency code. This configuration is not relevant for parsing. | [
"Postfix",
"formatted",
"output",
"with",
"currency",
"code",
".",
"This",
"configuration",
"is",
"not",
"relevant",
"for",
"parsing",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/utils/MonetaryFormat.java#L280-L286 |
23,476 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/utils/MonetaryFormat.java | MonetaryFormat.format | public CharSequence format(Monetary monetary) {
// preparation
int maxDecimals = minDecimals;
if (decimalGroups != null)
for (int group : decimalGroups)
maxDecimals += group;
int smallestUnitExponent = monetary.smallestUnitExponent();
checkState(maxDec... | java | public CharSequence format(Monetary monetary) {
// preparation
int maxDecimals = minDecimals;
if (decimalGroups != null)
for (int group : decimalGroups)
maxDecimals += group;
int smallestUnitExponent = monetary.smallestUnitExponent();
checkState(maxDec... | [
"public",
"CharSequence",
"format",
"(",
"Monetary",
"monetary",
")",
"{",
"// preparation",
"int",
"maxDecimals",
"=",
"minDecimals",
";",
"if",
"(",
"decimalGroups",
"!=",
"null",
")",
"for",
"(",
"int",
"group",
":",
"decimalGroups",
")",
"maxDecimals",
"+=... | Format the given monetary value to a human readable form. | [
"Format",
"the",
"given",
"monetary",
"value",
"to",
"a",
"human",
"readable",
"form",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/utils/MonetaryFormat.java#L341-L404 |
23,477 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/utils/MonetaryFormat.java | MonetaryFormat.code | public String code() {
if (codes == null)
return null;
if (codes[shift] == null)
throw new NumberFormatException("missing code for shift: " + shift);
return codes[shift];
} | java | public String code() {
if (codes == null)
return null;
if (codes[shift] == null)
throw new NumberFormatException("missing code for shift: " + shift);
return codes[shift];
} | [
"public",
"String",
"code",
"(",
")",
"{",
"if",
"(",
"codes",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"codes",
"[",
"shift",
"]",
"==",
"null",
")",
"throw",
"new",
"NumberFormatException",
"(",
"\"missing code for shift: \"",
"+",
"shift",
... | Get currency code that will be used for current shift. | [
"Get",
"currency",
"code",
"that",
"will",
"be",
"used",
"for",
"current",
"shift",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/utils/MonetaryFormat.java#L458-L464 |
23,478 | bitcoinj/bitcoinj | wallettemplate/src/main/java/wallettemplate/utils/AppDataDirectory.java | AppDataDirectory.get | public static Path get(String appName) {
final Path applicationDataDirectory = getPath(appName);
try {
Files.createDirectories(applicationDataDirectory);
} catch (IOException ioe) {
throw new RuntimeException("Couldn't find/create AppDataDirectory", ioe);
}
... | java | public static Path get(String appName) {
final Path applicationDataDirectory = getPath(appName);
try {
Files.createDirectories(applicationDataDirectory);
} catch (IOException ioe) {
throw new RuntimeException("Couldn't find/create AppDataDirectory", ioe);
}
... | [
"public",
"static",
"Path",
"get",
"(",
"String",
"appName",
")",
"{",
"final",
"Path",
"applicationDataDirectory",
"=",
"getPath",
"(",
"appName",
")",
";",
"try",
"{",
"Files",
".",
"createDirectories",
"(",
"applicationDataDirectory",
")",
";",
"}",
"catch"... | Get and create if necessary the Path to the application data directory.
@param appName The name of the current application
@return Path to the application data directory | [
"Get",
"and",
"create",
"if",
"necessary",
"the",
"Path",
"to",
"the",
"application",
"data",
"directory",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/wallettemplate/src/main/java/wallettemplate/utils/AppDataDirectory.java#L36-L46 |
23,479 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/crypto/HDKeyDerivation.java | HDKeyDerivation.deriveThisOrNextChildKey | public static DeterministicKey deriveThisOrNextChildKey(DeterministicKey parent, int childNumber) {
int nAttempts = 0;
ChildNumber child = new ChildNumber(childNumber);
boolean isHardened = child.isHardened();
while (nAttempts < MAX_CHILD_DERIVATION_ATTEMPTS) {
try {
... | java | public static DeterministicKey deriveThisOrNextChildKey(DeterministicKey parent, int childNumber) {
int nAttempts = 0;
ChildNumber child = new ChildNumber(childNumber);
boolean isHardened = child.isHardened();
while (nAttempts < MAX_CHILD_DERIVATION_ATTEMPTS) {
try {
... | [
"public",
"static",
"DeterministicKey",
"deriveThisOrNextChildKey",
"(",
"DeterministicKey",
"parent",
",",
"int",
"childNumber",
")",
"{",
"int",
"nAttempts",
"=",
"0",
";",
"ChildNumber",
"child",
"=",
"new",
"ChildNumber",
"(",
"childNumber",
")",
";",
"boolean... | Derives a key of the "extended" child number, ie. with the 0x80000000 bit specifying whether to use
hardened derivation or not. If derivation fails, tries a next child. | [
"Derives",
"a",
"key",
"of",
"the",
"extended",
"child",
"number",
"ie",
".",
"with",
"the",
"0x80000000",
"bit",
"specifying",
"whether",
"to",
"use",
"hardened",
"derivation",
"or",
"not",
".",
"If",
"derivation",
"fails",
"tries",
"a",
"next",
"child",
... | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/crypto/HDKeyDerivation.java#L121-L134 |
23,480 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/script/ScriptBuilder.java | ScriptBuilder.op | public ScriptBuilder op(int index, int opcode) {
checkArgument(opcode > OP_PUSHDATA4);
return addChunk(index, new ScriptChunk(opcode, null));
} | java | public ScriptBuilder op(int index, int opcode) {
checkArgument(opcode > OP_PUSHDATA4);
return addChunk(index, new ScriptChunk(opcode, null));
} | [
"public",
"ScriptBuilder",
"op",
"(",
"int",
"index",
",",
"int",
"opcode",
")",
"{",
"checkArgument",
"(",
"opcode",
">",
"OP_PUSHDATA4",
")",
";",
"return",
"addChunk",
"(",
"index",
",",
"new",
"ScriptChunk",
"(",
"opcode",
",",
"null",
")",
")",
";",... | Adds the given opcode to the given index in the program | [
"Adds",
"the",
"given",
"opcode",
"to",
"the",
"given",
"index",
"in",
"the",
"program"
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/script/ScriptBuilder.java#L80-L83 |
23,481 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/script/ScriptBuilder.java | ScriptBuilder.number | public ScriptBuilder number(int index, long num) {
if (num == -1) {
return op(index, OP_1NEGATE);
} else if (num >= 0 && num <= 16) {
return smallNum(index, (int) num);
} else {
return bigNum(index, num);
}
} | java | public ScriptBuilder number(int index, long num) {
if (num == -1) {
return op(index, OP_1NEGATE);
} else if (num >= 0 && num <= 16) {
return smallNum(index, (int) num);
} else {
return bigNum(index, num);
}
} | [
"public",
"ScriptBuilder",
"number",
"(",
"int",
"index",
",",
"long",
"num",
")",
"{",
"if",
"(",
"num",
"==",
"-",
"1",
")",
"{",
"return",
"op",
"(",
"index",
",",
"OP_1NEGATE",
")",
";",
"}",
"else",
"if",
"(",
"num",
">=",
"0",
"&&",
"num",
... | Adds the given number to the given index in the program. Automatically
uses shortest encoding possible. | [
"Adds",
"the",
"given",
"number",
"to",
"the",
"given",
"index",
"in",
"the",
"program",
".",
"Automatically",
"uses",
"shortest",
"encoding",
"possible",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/script/ScriptBuilder.java#L130-L138 |
23,482 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/script/ScriptBuilder.java | ScriptBuilder.smallNum | public ScriptBuilder smallNum(int index, int num) {
checkArgument(num >= 0, "Cannot encode negative numbers with smallNum");
checkArgument(num <= 16, "Cannot encode numbers larger than 16 with smallNum");
return addChunk(index, new ScriptChunk(Script.encodeToOpN(num), null));
} | java | public ScriptBuilder smallNum(int index, int num) {
checkArgument(num >= 0, "Cannot encode negative numbers with smallNum");
checkArgument(num <= 16, "Cannot encode numbers larger than 16 with smallNum");
return addChunk(index, new ScriptChunk(Script.encodeToOpN(num), null));
} | [
"public",
"ScriptBuilder",
"smallNum",
"(",
"int",
"index",
",",
"int",
"num",
")",
"{",
"checkArgument",
"(",
"num",
">=",
"0",
",",
"\"Cannot encode negative numbers with smallNum\"",
")",
";",
"checkArgument",
"(",
"num",
"<=",
"16",
",",
"\"Cannot encode numbe... | Adds the given number as a OP_N opcode to the given index in the program.
Only handles values 0-16 inclusive.
@see #number(long) | [
"Adds",
"the",
"given",
"number",
"as",
"a",
"OP_N",
"opcode",
"to",
"the",
"given",
"index",
"in",
"the",
"program",
".",
"Only",
"handles",
"values",
"0",
"-",
"16",
"inclusive",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/script/ScriptBuilder.java#L167-L171 |
23,483 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/script/ScriptBuilder.java | ScriptBuilder.bigNum | protected ScriptBuilder bigNum(int index, long num) {
final byte[] data;
if (num == 0) {
data = new byte[0];
} else {
Stack<Byte> result = new Stack<>();
final boolean neg = num < 0;
long absvalue = Math.abs(num);
while (absvalue != 0... | java | protected ScriptBuilder bigNum(int index, long num) {
final byte[] data;
if (num == 0) {
data = new byte[0];
} else {
Stack<Byte> result = new Stack<>();
final boolean neg = num < 0;
long absvalue = Math.abs(num);
while (absvalue != 0... | [
"protected",
"ScriptBuilder",
"bigNum",
"(",
"int",
"index",
",",
"long",
"num",
")",
"{",
"final",
"byte",
"[",
"]",
"data",
";",
"if",
"(",
"num",
"==",
"0",
")",
"{",
"data",
"=",
"new",
"byte",
"[",
"0",
"]",
";",
"}",
"else",
"{",
"Stack",
... | Adds the given number as a push data chunk to the given index in the program.
This is intended to use for negative numbers or values greater than 16, and although
it will accept numbers in the range 0-16 inclusive, the encoding would be
considered non-standard.
@see #number(long) | [
"Adds",
"the",
"given",
"number",
"as",
"a",
"push",
"data",
"chunk",
"to",
"the",
"given",
"index",
"in",
"the",
"program",
".",
"This",
"is",
"intended",
"to",
"use",
"for",
"negative",
"numbers",
"or",
"values",
"greater",
"than",
"16",
"and",
"althou... | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/script/ScriptBuilder.java#L181-L216 |
23,484 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/script/ScriptBuilder.java | ScriptBuilder.createOutputScript | public static Script createOutputScript(Address to) {
if (to instanceof LegacyAddress) {
ScriptType scriptType = to.getOutputScriptType();
if (scriptType == ScriptType.P2PKH)
return createP2PKHOutputScript(to.getHash());
else if (scriptType == ScriptType.P2SH)... | java | public static Script createOutputScript(Address to) {
if (to instanceof LegacyAddress) {
ScriptType scriptType = to.getOutputScriptType();
if (scriptType == ScriptType.P2PKH)
return createP2PKHOutputScript(to.getHash());
else if (scriptType == ScriptType.P2SH)... | [
"public",
"static",
"Script",
"createOutputScript",
"(",
"Address",
"to",
")",
"{",
"if",
"(",
"to",
"instanceof",
"LegacyAddress",
")",
"{",
"ScriptType",
"scriptType",
"=",
"to",
".",
"getOutputScriptType",
"(",
")",
";",
"if",
"(",
"scriptType",
"==",
"Sc... | Creates a scriptPubKey that encodes payment to the given address. | [
"Creates",
"a",
"scriptPubKey",
"that",
"encodes",
"payment",
"to",
"the",
"given",
"address",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/script/ScriptBuilder.java#L263-L282 |
23,485 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/script/ScriptBuilder.java | ScriptBuilder.createMultiSigInputScript | public static Script createMultiSigInputScript(List<TransactionSignature> signatures) {
List<byte[]> sigs = new ArrayList<>(signatures.size());
for (TransactionSignature signature : signatures) {
sigs.add(signature.encodeToBitcoin());
}
return createMultiSigInputScriptBytes(... | java | public static Script createMultiSigInputScript(List<TransactionSignature> signatures) {
List<byte[]> sigs = new ArrayList<>(signatures.size());
for (TransactionSignature signature : signatures) {
sigs.add(signature.encodeToBitcoin());
}
return createMultiSigInputScriptBytes(... | [
"public",
"static",
"Script",
"createMultiSigInputScript",
"(",
"List",
"<",
"TransactionSignature",
">",
"signatures",
")",
"{",
"List",
"<",
"byte",
"[",
"]",
">",
"sigs",
"=",
"new",
"ArrayList",
"<>",
"(",
"signatures",
".",
"size",
"(",
")",
")",
";",... | Create a program that satisfies an OP_CHECKMULTISIG program. | [
"Create",
"a",
"program",
"that",
"satisfies",
"an",
"OP_CHECKMULTISIG",
"program",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/script/ScriptBuilder.java#L319-L326 |
23,486 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/utils/BtcFormat.java | BtcFormat.getCoinInstance | public static BtcFormat getCoinInstance(Locale locale, int scale, int... groups) {
return getInstance(COIN_SCALE, locale, scale, boxAsList(groups));
} | java | public static BtcFormat getCoinInstance(Locale locale, int scale, int... groups) {
return getInstance(COIN_SCALE, locale, scale, boxAsList(groups));
} | [
"public",
"static",
"BtcFormat",
"getCoinInstance",
"(",
"Locale",
"locale",
",",
"int",
"scale",
",",
"int",
"...",
"groups",
")",
"{",
"return",
"getInstance",
"(",
"COIN_SCALE",
",",
"locale",
",",
"scale",
",",
"boxAsList",
"(",
"groups",
")",
")",
";"... | Return a newly-constructed instance for the given locale that will format
values in terms of bitcoins, with the given minimum number of fractional
decimal places. Optionally, repeating integer arguments can be passed, each
indicating the size of an additional group of fractional decimal places to be
used as necessary ... | [
"Return",
"a",
"newly",
"-",
"constructed",
"instance",
"for",
"the",
"given",
"locale",
"that",
"will",
"format",
"values",
"in",
"terms",
"of",
"bitcoins",
"with",
"the",
"given",
"minimum",
"number",
"of",
"fractional",
"decimal",
"places",
".",
"Optionally... | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/utils/BtcFormat.java#L968-L970 |
23,487 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/utils/BtcFormat.java | BtcFormat.getMilliInstance | public static BtcFormat getMilliInstance(int scale, int... groups) {
return getInstance(MILLICOIN_SCALE, defaultLocale(), scale, boxAsList(groups));
} | java | public static BtcFormat getMilliInstance(int scale, int... groups) {
return getInstance(MILLICOIN_SCALE, defaultLocale(), scale, boxAsList(groups));
} | [
"public",
"static",
"BtcFormat",
"getMilliInstance",
"(",
"int",
"scale",
",",
"int",
"...",
"groups",
")",
"{",
"return",
"getInstance",
"(",
"MILLICOIN_SCALE",
",",
"defaultLocale",
"(",
")",
",",
"scale",
",",
"boxAsList",
"(",
"groups",
")",
")",
";",
... | Return a new millicoin-denominated formatter with the specified fractional decimal
placing. The returned object will format and parse values according to the default
locale, and will format the fractional part of numbers with the given minimum number of
fractional decimal places. Optionally, repeating integer argumen... | [
"Return",
"a",
"new",
"millicoin",
"-",
"denominated",
"formatter",
"with",
"the",
"specified",
"fractional",
"decimal",
"placing",
".",
"The",
"returned",
"object",
"will",
"format",
"and",
"parse",
"values",
"according",
"to",
"the",
"default",
"locale",
"and"... | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/utils/BtcFormat.java#L996-L998 |
23,488 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/utils/BtcFormat.java | BtcFormat.getMilliInstance | public static BtcFormat getMilliInstance(Locale locale, int scale, int... groups) {
return getInstance(MILLICOIN_SCALE, locale, scale, boxAsList(groups));
} | java | public static BtcFormat getMilliInstance(Locale locale, int scale, int... groups) {
return getInstance(MILLICOIN_SCALE, locale, scale, boxAsList(groups));
} | [
"public",
"static",
"BtcFormat",
"getMilliInstance",
"(",
"Locale",
"locale",
",",
"int",
"scale",
",",
"int",
"...",
"groups",
")",
"{",
"return",
"getInstance",
"(",
"MILLICOIN_SCALE",
",",
"locale",
",",
"scale",
",",
"boxAsList",
"(",
"groups",
")",
")",... | Return a new millicoin-denominated formatter for the given locale with the specified
fractional decimal placing. The returned object will format the fractional part of
numbers with the given minimum number of fractional decimal places. Optionally,
repeating integer arguments can be passed, each indicating the size of... | [
"Return",
"a",
"new",
"millicoin",
"-",
"denominated",
"formatter",
"for",
"the",
"given",
"locale",
"with",
"the",
"specified",
"fractional",
"decimal",
"placing",
".",
"The",
"returned",
"object",
"will",
"format",
"the",
"fractional",
"part",
"of",
"numbers",... | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/utils/BtcFormat.java#L1008-L1010 |
23,489 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/utils/BtcFormat.java | BtcFormat.getMicroInstance | public static BtcFormat getMicroInstance(int scale, int... groups) {
return getInstance(MICROCOIN_SCALE, defaultLocale(), scale, boxAsList(groups));
} | java | public static BtcFormat getMicroInstance(int scale, int... groups) {
return getInstance(MICROCOIN_SCALE, defaultLocale(), scale, boxAsList(groups));
} | [
"public",
"static",
"BtcFormat",
"getMicroInstance",
"(",
"int",
"scale",
",",
"int",
"...",
"groups",
")",
"{",
"return",
"getInstance",
"(",
"MICROCOIN_SCALE",
",",
"defaultLocale",
"(",
")",
",",
"scale",
",",
"boxAsList",
"(",
"groups",
")",
")",
";",
... | Return a new microcoin-denominated formatter with the specified fractional decimal
placing. The returned object will format and parse values according to the default
locale, and will format the fractional part of numbers with the given minimum number of
fractional decimal places. Optionally, repeating integer argumen... | [
"Return",
"a",
"new",
"microcoin",
"-",
"denominated",
"formatter",
"with",
"the",
"specified",
"fractional",
"decimal",
"placing",
".",
"The",
"returned",
"object",
"will",
"format",
"and",
"parse",
"values",
"according",
"to",
"the",
"default",
"locale",
"and"... | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/utils/BtcFormat.java#L1036-L1038 |
23,490 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/utils/BtcFormat.java | BtcFormat.getMicroInstance | public static BtcFormat getMicroInstance(Locale locale, int scale, int... groups) {
return getInstance(MICROCOIN_SCALE, locale, scale, boxAsList(groups));
} | java | public static BtcFormat getMicroInstance(Locale locale, int scale, int... groups) {
return getInstance(MICROCOIN_SCALE, locale, scale, boxAsList(groups));
} | [
"public",
"static",
"BtcFormat",
"getMicroInstance",
"(",
"Locale",
"locale",
",",
"int",
"scale",
",",
"int",
"...",
"groups",
")",
"{",
"return",
"getInstance",
"(",
"MICROCOIN_SCALE",
",",
"locale",
",",
"scale",
",",
"boxAsList",
"(",
"groups",
")",
")",... | Return a new microcoin-denominated formatter for the given locale with the specified
fractional decimal placing. The returned object will format the fractional part of
numbers with the given minimum number of fractional decimal places. Optionally,
repeating integer arguments can be passed, each indicating the size of... | [
"Return",
"a",
"new",
"microcoin",
"-",
"denominated",
"formatter",
"for",
"the",
"given",
"locale",
"with",
"the",
"specified",
"fractional",
"decimal",
"placing",
".",
"The",
"returned",
"object",
"will",
"format",
"the",
"fractional",
"part",
"of",
"numbers",... | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/utils/BtcFormat.java#L1048-L1050 |
23,491 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/utils/BtcFormat.java | BtcFormat.getInstance | public static BtcFormat getInstance(int scale, int minDecimals, int... groups) {
return getInstance(scale, defaultLocale(), minDecimals, boxAsList(groups));
} | java | public static BtcFormat getInstance(int scale, int minDecimals, int... groups) {
return getInstance(scale, defaultLocale(), minDecimals, boxAsList(groups));
} | [
"public",
"static",
"BtcFormat",
"getInstance",
"(",
"int",
"scale",
",",
"int",
"minDecimals",
",",
"int",
"...",
"groups",
")",
"{",
"return",
"getInstance",
"(",
"scale",
",",
"defaultLocale",
"(",
")",
",",
"minDecimals",
",",
"boxAsList",
"(",
"groups",... | Return a new fixed-denomination formatter with the specified fractional decimal
placing. The first argument specifies the denomination as the size of the
shift from coin-denomination in increasingly-precise decimal places. The returned object will format
and parse values according to the default locale, and will form... | [
"Return",
"a",
"new",
"fixed",
"-",
"denomination",
"formatter",
"with",
"the",
"specified",
"fractional",
"decimal",
"placing",
".",
"The",
"first",
"argument",
"specifies",
"the",
"denomination",
"as",
"the",
"size",
"of",
"the",
"shift",
"from",
"coin",
"-"... | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/utils/BtcFormat.java#L1062-L1064 |
23,492 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/utils/BtcFormat.java | BtcFormat.getInstance | public static BtcFormat getInstance(int scale, Locale locale, int minDecimals, int... groups) {
return getInstance(scale, locale, minDecimals, boxAsList(groups));
} | java | public static BtcFormat getInstance(int scale, Locale locale, int minDecimals, int... groups) {
return getInstance(scale, locale, minDecimals, boxAsList(groups));
} | [
"public",
"static",
"BtcFormat",
"getInstance",
"(",
"int",
"scale",
",",
"Locale",
"locale",
",",
"int",
"minDecimals",
",",
"int",
"...",
"groups",
")",
"{",
"return",
"getInstance",
"(",
"scale",
",",
"locale",
",",
"minDecimals",
",",
"boxAsList",
"(",
... | Return a new fixed-denomination formatter for the given locale, with the specified
fractional decimal placing. The first argument specifies the denomination as the size
of the shift from coin-denomination in increasingly-precise decimal places. The third
parameter is the minimum number of fractional decimal places to... | [
"Return",
"a",
"new",
"fixed",
"-",
"denomination",
"formatter",
"for",
"the",
"given",
"locale",
"with",
"the",
"specified",
"fractional",
"decimal",
"placing",
".",
"The",
"first",
"argument",
"specifies",
"the",
"denomination",
"as",
"the",
"size",
"of",
"t... | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/utils/BtcFormat.java#L1098-L1100 |
23,493 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/utils/BtcFormat.java | BtcFormat.setFormatterDigits | private static ImmutableList<Integer> setFormatterDigits(DecimalFormat formatter, int min, int max) {
ImmutableList<Integer> ante = ImmutableList.of(
formatter.getMinimumFractionDigits(),
formatter.getMaximumFractionDigits()
);
formatter.setMinimumFractionDigits(min);
... | java | private static ImmutableList<Integer> setFormatterDigits(DecimalFormat formatter, int min, int max) {
ImmutableList<Integer> ante = ImmutableList.of(
formatter.getMinimumFractionDigits(),
formatter.getMaximumFractionDigits()
);
formatter.setMinimumFractionDigits(min);
... | [
"private",
"static",
"ImmutableList",
"<",
"Integer",
">",
"setFormatterDigits",
"(",
"DecimalFormat",
"formatter",
",",
"int",
"min",
",",
"int",
"max",
")",
"{",
"ImmutableList",
"<",
"Integer",
">",
"ante",
"=",
"ImmutableList",
".",
"of",
"(",
"formatter",... | Sets the number of fractional decimal places to be displayed on the given
NumberFormat object to the value of the given integer.
@return The minimum and maximum fractional places settings that the
formatter had before this change, as an ImmutableList. | [
"Sets",
"the",
"number",
"of",
"fractional",
"decimal",
"places",
"to",
"be",
"displayed",
"on",
"the",
"given",
"NumberFormat",
"object",
"to",
"the",
"value",
"of",
"the",
"given",
"integer",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/utils/BtcFormat.java#L1239-L1247 |
23,494 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/utils/BtcFormat.java | BtcFormat.calculateFractionPlaces | private static int calculateFractionPlaces(
BigDecimal unitCount, int scale, int minDecimals, List<Integer> fractionGroups)
{
/* Taking into account BOTH the user's preference for decimal-place groups, AND the prohibition
* against displaying a fractional number of satoshis, determine the m... | java | private static int calculateFractionPlaces(
BigDecimal unitCount, int scale, int minDecimals, List<Integer> fractionGroups)
{
/* Taking into account BOTH the user's preference for decimal-place groups, AND the prohibition
* against displaying a fractional number of satoshis, determine the m... | [
"private",
"static",
"int",
"calculateFractionPlaces",
"(",
"BigDecimal",
"unitCount",
",",
"int",
"scale",
",",
"int",
"minDecimals",
",",
"List",
"<",
"Integer",
">",
"fractionGroups",
")",
"{",
"/* Taking into account BOTH the user's preference for decimal-place groups, ... | Return the number of fractional decimal places to be displayed when formatting
the given number of monetary units of the denomination indicated by the given decimal scale value,
where 0 = coin, 3 = millicoin, and so on.
@param unitCount the number of monetary units to be formatted
@param scale the denomi... | [
"Return",
"the",
"number",
"of",
"fractional",
"decimal",
"places",
"to",
"be",
"displayed",
"when",
"formatting",
"the",
"given",
"number",
"of",
"monetary",
"units",
"of",
"the",
"denomination",
"indicated",
"by",
"the",
"given",
"decimal",
"scale",
"value",
... | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/utils/BtcFormat.java#L1258-L1278 |
23,495 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/utils/BtcFormat.java | BtcFormat.inSatoshis | private static BigInteger inSatoshis(Object qty) {
BigInteger satoshis;
// the value might be bitcoins or satoshis
if (qty instanceof Long || qty instanceof Integer)
satoshis = BigInteger.valueOf(((Number)qty).longValue());
else if (qty instanceof BigInteger)
sato... | java | private static BigInteger inSatoshis(Object qty) {
BigInteger satoshis;
// the value might be bitcoins or satoshis
if (qty instanceof Long || qty instanceof Integer)
satoshis = BigInteger.valueOf(((Number)qty).longValue());
else if (qty instanceof BigInteger)
sato... | [
"private",
"static",
"BigInteger",
"inSatoshis",
"(",
"Object",
"qty",
")",
"{",
"BigInteger",
"satoshis",
";",
"// the value might be bitcoins or satoshis",
"if",
"(",
"qty",
"instanceof",
"Long",
"||",
"qty",
"instanceof",
"Integer",
")",
"satoshis",
"=",
"BigInte... | Takes an object representing a bitcoin quantity of any type the
client is permitted to pass us, and return a BigInteger representing the
number of satoshis having the equivalent value. | [
"Takes",
"an",
"object",
"representing",
"a",
"bitcoin",
"quantity",
"of",
"any",
"type",
"the",
"client",
"is",
"permitted",
"to",
"pass",
"us",
"and",
"return",
"a",
"BigInteger",
"representing",
"the",
"number",
"of",
"satoshis",
"having",
"the",
"equivalen... | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/utils/BtcFormat.java#L1284-L1300 |
23,496 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/utils/BtcFormat.java | BtcFormat.prefixUnitsIndicator | protected static void prefixUnitsIndicator(DecimalFormat numberFormat, int scale) {
checkState(Thread.holdsLock(numberFormat)); // make sure caller intends to reset before changing
DecimalFormatSymbols fs = numberFormat.getDecimalFormatSymbols();
setSymbolAndCode(numberFormat,
prefix... | java | protected static void prefixUnitsIndicator(DecimalFormat numberFormat, int scale) {
checkState(Thread.holdsLock(numberFormat)); // make sure caller intends to reset before changing
DecimalFormatSymbols fs = numberFormat.getDecimalFormatSymbols();
setSymbolAndCode(numberFormat,
prefix... | [
"protected",
"static",
"void",
"prefixUnitsIndicator",
"(",
"DecimalFormat",
"numberFormat",
",",
"int",
"scale",
")",
"{",
"checkState",
"(",
"Thread",
".",
"holdsLock",
"(",
"numberFormat",
")",
")",
";",
"// make sure caller intends to reset before changing",
"Decima... | Set both the currency symbol and code of the underlying, mutable NumberFormat object
according to the given denominational units scale factor. This is for formatting, not parsing.
<p>Set back to zero when you're done formatting otherwise immutability, equals() and
hashCode() will break!
@param scale Number of places... | [
"Set",
"both",
"the",
"currency",
"symbol",
"and",
"code",
"of",
"the",
"underlying",
"mutable",
"NumberFormat",
"object",
"according",
"to",
"the",
"given",
"denominational",
"units",
"scale",
"factor",
".",
"This",
"is",
"for",
"formatting",
"not",
"parsing",
... | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/utils/BtcFormat.java#L1384-L1390 |
23,497 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/utils/BtcFormat.java | BtcFormat.negify | protected static String negify(String pattern) {
if (pattern.contains(";")) return pattern;
else {
if (pattern.contains("-"))
throw new IllegalStateException("Positive pattern contains negative sign");
// the regex matches everything until the first non-quoted num... | java | protected static String negify(String pattern) {
if (pattern.contains(";")) return pattern;
else {
if (pattern.contains("-"))
throw new IllegalStateException("Positive pattern contains negative sign");
// the regex matches everything until the first non-quoted num... | [
"protected",
"static",
"String",
"negify",
"(",
"String",
"pattern",
")",
"{",
"if",
"(",
"pattern",
".",
"contains",
"(",
"\";\"",
")",
")",
"return",
"pattern",
";",
"else",
"{",
"if",
"(",
"pattern",
".",
"contains",
"(",
"\"-\"",
")",
")",
"throw",... | Guarantee a formatting pattern has a subpattern for negative values. This method takes
a pattern that may be missing a negative subpattern, and returns the same pattern with
a negative subpattern appended as needed.
<p>This method accommodates an imperfection in the Java formatting code and distributed
locale data. ... | [
"Guarantee",
"a",
"formatting",
"pattern",
"has",
"a",
"subpattern",
"for",
"negative",
"values",
".",
"This",
"method",
"takes",
"a",
"pattern",
"that",
"may",
"be",
"missing",
"a",
"negative",
"subpattern",
"and",
"returns",
"the",
"same",
"pattern",
"with",... | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/utils/BtcFormat.java#L1512-L1520 |
23,498 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/protocols/channels/StoredServerChannel.java | StoredServerChannel.setConnectedHandler | synchronized PaymentChannelServer setConnectedHandler(PaymentChannelServer connectedHandler, boolean override) {
if (this.connectedHandler != null && !override)
return this.connectedHandler;
this.connectedHandler = connectedHandler;
return connectedHandler;
} | java | synchronized PaymentChannelServer setConnectedHandler(PaymentChannelServer connectedHandler, boolean override) {
if (this.connectedHandler != null && !override)
return this.connectedHandler;
this.connectedHandler = connectedHandler;
return connectedHandler;
} | [
"synchronized",
"PaymentChannelServer",
"setConnectedHandler",
"(",
"PaymentChannelServer",
"connectedHandler",
",",
"boolean",
"override",
")",
"{",
"if",
"(",
"this",
".",
"connectedHandler",
"!=",
"null",
"&&",
"!",
"override",
")",
"return",
"this",
".",
"connec... | Attempts to connect the given handler to this, returning true if it is the new handler, false if there was
already one attached. | [
"Attempts",
"to",
"connect",
"the",
"given",
"handler",
"to",
"this",
"returning",
"true",
"if",
"it",
"is",
"the",
"new",
"handler",
"false",
"if",
"there",
"was",
"already",
"one",
"attached",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/protocols/channels/StoredServerChannel.java#L78-L83 |
23,499 | bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/wallet/DefaultRiskAnalysis.java | DefaultRiskAnalysis.isOutputStandard | public static RuleViolation isOutputStandard(TransactionOutput output) {
if (output.getValue().compareTo(MIN_ANALYSIS_NONDUST_OUTPUT) < 0)
return RuleViolation.DUST;
for (ScriptChunk chunk : output.getScriptPubKey().getChunks()) {
if (chunk.isPushData() && !chunk.isShortestPossib... | java | public static RuleViolation isOutputStandard(TransactionOutput output) {
if (output.getValue().compareTo(MIN_ANALYSIS_NONDUST_OUTPUT) < 0)
return RuleViolation.DUST;
for (ScriptChunk chunk : output.getScriptPubKey().getChunks()) {
if (chunk.isPushData() && !chunk.isShortestPossib... | [
"public",
"static",
"RuleViolation",
"isOutputStandard",
"(",
"TransactionOutput",
"output",
")",
"{",
"if",
"(",
"output",
".",
"getValue",
"(",
")",
".",
"compareTo",
"(",
"MIN_ANALYSIS_NONDUST_OUTPUT",
")",
"<",
"0",
")",
"return",
"RuleViolation",
".",
"DUST... | Checks the output to see if the script violates a standardness rule. Not complete. | [
"Checks",
"the",
"output",
"to",
"see",
"if",
"the",
"script",
"violates",
"a",
"standardness",
"rule",
".",
"Not",
"complete",
"."
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/wallet/DefaultRiskAnalysis.java#L175-L183 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.