mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2024-11-19 01:40:26 +01:00
Renamespace to org.bitcoinj away from com.google.bitcoin, as bitcoinj is no longer a Google project and being namespaced under com.google causes issues with Sonatype/Maven Central.
To fixinate your code: find . -name '*.java' | xargs sed -i .bak 's/import com.google.bitcoin./import org.bitcoinj./g;s/import static com.google.bitcoin./import static org.bitcoinj./g'
This commit is contained in:
parent
48de05ac0f
commit
0a6f901b23
@ -45,7 +45,7 @@ If you send coins to that address, it will forward them on to the address you sp
|
|||||||
|
|
||||||
```
|
```
|
||||||
cd examples
|
cd examples
|
||||||
mvn exec:java -Dexec.mainClass=com.google.bitcoin.examples.ForwardingService -Dexec.args="<insert a bitcoin address here>"
|
mvn exec:java -Dexec.mainClass=org.bitcoinj.examples.ForwardingService -Dexec.args="<insert a bitcoin address here>"
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that this example app *does not use checkpointing*, so the initial chain sync will be pretty slow. You can make an app that starts up and does the initial sync much faster by including a checkpoints file; see the documentation for
|
Note that this example app *does not use checkpointing*, so the initial chain sync will be pretty slow. You can make an app that starts up and does the initial sync much faster by including a checkpoints file; see the documentation for
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
<!-- The code is correct but findbugs can't analyze it properly -->
|
<!-- The code is correct but findbugs can't analyze it properly -->
|
||||||
<Match>
|
<Match>
|
||||||
<Bug code="SF"/>
|
<Bug code="SF"/>
|
||||||
<Class name="com.google.bitcoin.core.BloomFilter"/>
|
<Class name="org.bitcoinj.core.BloomFilter"/>
|
||||||
</Match>
|
</Match>
|
||||||
|
|
||||||
<!-- fb doesn't like the odd API this class has -->
|
<!-- fb doesn't like the odd API this class has -->
|
||||||
|
@ -20,12 +20,12 @@
|
|||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.google</groupId>
|
<groupId>org.bitcoinj</groupId>
|
||||||
<artifactId>bitcoinj-parent</artifactId>
|
<artifactId>bitcoinj-parent</artifactId>
|
||||||
<version>0.12-SNAPSHOT</version>
|
<version>0.12-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>bitcoinj</artifactId>
|
<artifactId>bitcoinj-core</artifactId>
|
||||||
|
|
||||||
<name>bitcoinj</name>
|
<name>bitcoinj</name>
|
||||||
<description>A Java Bitcoin library</description>
|
<description>A Java Bitcoin library</description>
|
||||||
@ -246,7 +246,7 @@
|
|||||||
<artifactItems>
|
<artifactItems>
|
||||||
<artifactItem>
|
<artifactItem>
|
||||||
<outputDirectory>target/test-classes/</outputDirectory>
|
<outputDirectory>target/test-classes/</outputDirectory>
|
||||||
<groupId>com.google</groupId>
|
<groupId>org.bitcoinj</groupId>
|
||||||
<artifactId>bitcoinj</artifactId>
|
<artifactId>bitcoinj</artifactId>
|
||||||
<version>0.12-SNAPSHOT</version>
|
<version>0.12-SNAPSHOT</version>
|
||||||
</artifactItem>
|
</artifactItem>
|
||||||
@ -280,7 +280,7 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<archive>
|
<archive>
|
||||||
<manifest>
|
<manifest>
|
||||||
<mainClass>com.google.bitcoin.core.BitcoindComparisonTool</mainClass>
|
<mainClass>org.bitcoinj.core.BitcoindComparisonTool</mainClass>
|
||||||
<addClasspath>false</addClasspath>
|
<addClasspath>false</addClasspath>
|
||||||
</manifest>
|
</manifest>
|
||||||
</archive>
|
</archive>
|
||||||
|
@ -15,12 +15,12 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import com.google.bitcoin.store.BlockStore;
|
import org.bitcoinj.store.BlockStore;
|
||||||
import com.google.bitcoin.store.BlockStoreException;
|
import org.bitcoinj.store.BlockStoreException;
|
||||||
import com.google.bitcoin.utils.ListenerRegistration;
|
import org.bitcoinj.utils.ListenerRegistration;
|
||||||
import com.google.bitcoin.utils.Threading;
|
import org.bitcoinj.utils.Threading;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
@ -47,7 +47,7 @@ import static com.google.common.base.Preconditions.*;
|
|||||||
* <p>An AbstractBlockChain implementation must be connected to a {@link BlockStore} implementation. The chain object
|
* <p>An AbstractBlockChain implementation must be connected to a {@link BlockStore} implementation. The chain object
|
||||||
* by itself doesn't store any data, that's delegated to the store. Which store you use is a decision best made by
|
* by itself doesn't store any data, that's delegated to the store. Which store you use is a decision best made by
|
||||||
* reading the getting started guide, but briefly, fully validating block chains need fully validating stores. In
|
* reading the getting started guide, but briefly, fully validating block chains need fully validating stores. In
|
||||||
* the lightweight SPV mode, a {@link com.google.bitcoin.store.SPVBlockStore} is the right choice.</p>
|
* the lightweight SPV mode, a {@link org.bitcoinj.store.SPVBlockStore} is the right choice.</p>
|
||||||
*
|
*
|
||||||
* <p>This class implements an abstract class which makes it simple to create a BlockChain that does/doesn't do full
|
* <p>This class implements an abstract class which makes it simple to create a BlockChain that does/doesn't do full
|
||||||
* verification. It verifies headers and is implements most of what is required to implement SPV mode, but
|
* verification. It verifies headers and is implements most of what is required to implement SPV mode, but
|
||||||
@ -56,7 +56,7 @@ import static com.google.common.base.Preconditions.*;
|
|||||||
* <p>There are two subclasses of AbstractBlockChain that are useful: {@link BlockChain}, which is the simplest
|
* <p>There are two subclasses of AbstractBlockChain that are useful: {@link BlockChain}, which is the simplest
|
||||||
* class and implements <i>simplified payment verification</i>. This is a lightweight and efficient mode that does
|
* class and implements <i>simplified payment verification</i>. This is a lightweight and efficient mode that does
|
||||||
* not verify the contents of blocks, just their headers. A {@link FullPrunedBlockChain} paired with a
|
* not verify the contents of blocks, just their headers. A {@link FullPrunedBlockChain} paired with a
|
||||||
* {@link com.google.bitcoin.store.H2FullPrunedBlockStore} implements full verification, which is equivalent to the
|
* {@link org.bitcoinj.store.H2FullPrunedBlockStore} implements full verification, which is equivalent to the
|
||||||
* original Satoshi client. To learn more about the alternative security models, please consult the articles on the
|
* original Satoshi client. To learn more about the alternative security models, please consult the articles on the
|
||||||
* website.</p>
|
* website.</p>
|
||||||
*
|
*
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -14,10 +14,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import com.google.bitcoin.script.Script;
|
import org.bitcoinj.script.Script;
|
||||||
import com.google.bitcoin.wallet.AbstractKeyChainEventListener;
|
import org.bitcoinj.wallet.AbstractKeyChainEventListener;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -15,10 +15,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import com.google.bitcoin.params.Networks;
|
import org.bitcoinj.params.Networks;
|
||||||
import com.google.bitcoin.script.Script;
|
import org.bitcoinj.script.Script;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class AddressFormatException extends Exception {
|
public class AddressFormatException extends Exception {
|
@ -1,4 +1,4 @@
|
|||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -28,7 +28,7 @@ import java.nio.ByteBuffer;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static com.google.bitcoin.core.Utils.*;
|
import static org.bitcoinj.core.Utils.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Methods to serialize and de-serialize messages to the Bitcoin network format as defined in
|
* <p>Methods to serialize and de-serialize messages to the Bitcoin network format as defined in
|
@ -14,10 +14,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import com.google.bitcoin.script.Script;
|
import org.bitcoinj.script.Script;
|
||||||
import com.google.bitcoin.script.ScriptBuilder;
|
import org.bitcoinj.script.ScriptBuilder;
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
@ -35,9 +35,9 @@ import java.util.Date;
|
|||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.google.bitcoin.core.Coin.FIFTY_COINS;
|
import static org.bitcoinj.core.Coin.FIFTY_COINS;
|
||||||
import static com.google.bitcoin.core.Utils.doubleDigest;
|
import static org.bitcoinj.core.Utils.doubleDigest;
|
||||||
import static com.google.bitcoin.core.Utils.doubleDigestTwoBuffers;
|
import static org.bitcoinj.core.Utils.doubleDigestTwoBuffers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>A block is a group of transactions, and is one of the fundamental data structures of the Bitcoin system.
|
* <p>A block is a group of transactions, and is one of the fundamental data structures of the Bitcoin system.
|
||||||
@ -164,7 +164,7 @@ public class Block extends Message {
|
|||||||
* the system it was 50 coins per block, in late 2012 it went to 25 coins per block, and so on. The size of
|
* the system it was 50 coins per block, in late 2012 it went to 25 coins per block, and so on. The size of
|
||||||
* a coinbase transaction is inflation plus fees.</p>
|
* a coinbase transaction is inflation plus fees.</p>
|
||||||
*
|
*
|
||||||
* <p>The half-life is controlled by {@link com.google.bitcoin.core.NetworkParameters#getSubsidyDecreaseBlockCount()}.
|
* <p>The half-life is controlled by {@link org.bitcoinj.core.NetworkParameters#getSubsidyDecreaseBlockCount()}.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
public Coin getBlockInflation(int height) {
|
public Coin getBlockInflation(int height) {
|
||||||
@ -915,7 +915,7 @@ public class Block extends Message {
|
|||||||
* Returns the difficulty of the proof of work that this block should meet encoded <b>in compact form</b>. The {@link
|
* Returns the difficulty of the proof of work that this block should meet encoded <b>in compact form</b>. The {@link
|
||||||
* BlockChain} verifies that this is not too easy by looking at the length of the chain when the block is added.
|
* BlockChain} verifies that this is not too easy by looking at the length of the chain when the block is added.
|
||||||
* To find the actual value the hash should be compared against, use
|
* To find the actual value the hash should be compared against, use
|
||||||
* {@link com.google.bitcoin.core.Block#getDifficultyTargetAsInteger()}. Note that this is <b>not</b> the same as
|
* {@link org.bitcoinj.core.Block#getDifficultyTargetAsInteger()}. Note that this is <b>not</b> the same as
|
||||||
* the difficulty value reported by the Bitcoin "getdifficulty" RPC that you may see on various block explorers.
|
* the difficulty value reported by the Bitcoin "getdifficulty" RPC that you may see on various block explorers.
|
||||||
* That number is the result of applying a formula to the underlying difficulty to normalize the minimum to 1.
|
* That number is the result of applying a formula to the underlying difficulty to normalize the minimum to 1.
|
||||||
* Calculating the difficulty that way is currently unsupported.
|
* Calculating the difficulty that way is currently unsupported.
|
@ -15,12 +15,12 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkArgument;
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
|
|
||||||
import com.google.bitcoin.store.BlockStore;
|
import org.bitcoinj.store.BlockStore;
|
||||||
import com.google.bitcoin.store.BlockStoreException;
|
import org.bitcoinj.store.BlockStoreException;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -40,8 +40,8 @@ public class BlockChain extends AbstractBlockChain {
|
|||||||
* one from scratch, or you can deserialize a saved wallet from disk using {@link Wallet#loadFromFile(java.io.File)}
|
* one from scratch, or you can deserialize a saved wallet from disk using {@link Wallet#loadFromFile(java.io.File)}
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* <p>For the store, you should use {@link com.google.bitcoin.store.SPVBlockStore} or you could also try a
|
* <p>For the store, you should use {@link org.bitcoinj.store.SPVBlockStore} or you could also try a
|
||||||
* {@link com.google.bitcoin.store.MemoryBlockStore} if you want to hold all headers in RAM and don't care about
|
* {@link org.bitcoinj.store.MemoryBlockStore} if you want to hold all headers in RAM and don't care about
|
||||||
* disk serialization (this is rare).</p>
|
* disk serialization (this is rare).</p>
|
||||||
*/
|
*/
|
||||||
public BlockChain(NetworkParameters params, Wallet wallet, BlockStore blockStore) throws BlockStoreException {
|
public BlockChain(NetworkParameters params, Wallet wallet, BlockStore blockStore) throws BlockStoreException {
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -26,8 +26,8 @@ import java.util.List;
|
|||||||
public interface BlockChainListener {
|
public interface BlockChainListener {
|
||||||
/**
|
/**
|
||||||
* Called when a new block on the best chain is seen, after relevant transactions are extracted and sent to
|
* Called when a new block on the best chain is seen, after relevant transactions are extracted and sent to
|
||||||
* us via either {@link #receiveFromBlock(Transaction, StoredBlock, com.google.bitcoin.core.BlockChain.NewBlockType, int)}
|
* us via either {@link #receiveFromBlock(Transaction, StoredBlock, org.bitcoinj.core.BlockChain.NewBlockType, int)}
|
||||||
* or {@link #notifyTransactionIsInBlock(Sha256Hash, StoredBlock, com.google.bitcoin.core.BlockChain.NewBlockType, int)}.
|
* or {@link #notifyTransactionIsInBlock(Sha256Hash, StoredBlock, org.bitcoinj.core.BlockChain.NewBlockType, int)}.
|
||||||
* If this block is causing a re-organise to a new chain, this method is NOT called even though the block may be
|
* If this block is causing a re-organise to a new chain, this method is NOT called even though the block may be
|
||||||
* the new best block: your reorganize implementation is expected to do whatever would normally be done do for a new
|
* the new best block: your reorganize implementation is expected to do whatever would normally be done do for a new
|
||||||
* best block in this case.
|
* best block in this case.
|
@ -14,10 +14,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import com.google.bitcoin.script.Script;
|
import org.bitcoinj.script.Script;
|
||||||
import com.google.bitcoin.script.ScriptChunk;
|
import org.bitcoinj.script.ScriptChunk;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ public class BloomFilter extends Message {
|
|||||||
* It should be a random value, however secureness of the random value is of no great consequence.</p>
|
* It should be a random value, however secureness of the random value is of no great consequence.</p>
|
||||||
*
|
*
|
||||||
* <p>updateFlag is used to control filter behaviour on the server (remote node) side when it encounters a hit.
|
* <p>updateFlag is used to control filter behaviour on the server (remote node) side when it encounters a hit.
|
||||||
* See {@link com.google.bitcoin.core.BloomFilter.BloomUpdate} for a brief description of each mode. The purpose
|
* See {@link org.bitcoinj.core.BloomFilter.BloomUpdate} for a brief description of each mode. The purpose
|
||||||
* of this flag is to reduce network round-tripping and avoid over-dirtying the filter for the most common
|
* of this flag is to reduce network round-tripping and avoid over-dirtying the filter for the most common
|
||||||
* wallet configurations.</p>
|
* wallet configurations.</p>
|
||||||
*/
|
*/
|
||||||
@ -270,7 +270,7 @@ public class BloomFilter extends Message {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this filter will match anything. See {@link com.google.bitcoin.core.BloomFilter#setMatchAll()}
|
* Returns true if this filter will match anything. See {@link org.bitcoinj.core.BloomFilter#setMatchAll()}
|
||||||
* for when this can be a useful thing to do.
|
* for when this can be a useful thing to do.
|
||||||
*/
|
*/
|
||||||
public synchronized boolean matchesAll() {
|
public synchronized boolean matchesAll() {
|
@ -14,11 +14,11 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import com.google.bitcoin.store.BlockStore;
|
import org.bitcoinj.store.BlockStore;
|
||||||
import com.google.bitcoin.store.BlockStoreException;
|
import org.bitcoinj.store.BlockStoreException;
|
||||||
import com.google.bitcoin.store.FullPrunedBlockStore;
|
import org.bitcoinj.store.FullPrunedBlockStore;
|
||||||
import com.google.common.base.Charsets;
|
import com.google.common.base.Charsets;
|
||||||
import com.google.common.hash.HashCode;
|
import com.google.common.hash.HashCode;
|
||||||
import com.google.common.hash.Hasher;
|
import com.google.common.hash.Hasher;
|
||||||
@ -55,7 +55,7 @@ import static com.google.common.base.Preconditions.*;
|
|||||||
* </ol>
|
* </ol>
|
||||||
*
|
*
|
||||||
* <p>Checkpoints are used by the SPV {@link BlockChain} to initialize fresh
|
* <p>Checkpoints are used by the SPV {@link BlockChain} to initialize fresh
|
||||||
* {@link com.google.bitcoin.store.SPVBlockStore}s. They are not used by fully validating mode, which instead has a
|
* {@link org.bitcoinj.store.SPVBlockStore}s. They are not used by fully validating mode, which instead has a
|
||||||
* different concept of checkpoints that are used to hard-code the validity of blocks that violate BIP30 (duplicate
|
* different concept of checkpoints that are used to hard-code the validity of blocks that violate BIP30 (duplicate
|
||||||
* coinbase transactions). Those "checkpoints" can be found in NetworkParameters.</p>
|
* coinbase transactions). Those "checkpoints" can be found in NetworkParameters.</p>
|
||||||
*
|
*
|
@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
@ -14,9 +14,9 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import com.google.bitcoin.utils.MonetaryFormat;
|
import org.bitcoinj.utils.MonetaryFormat;
|
||||||
import com.google.common.math.LongMath;
|
import com.google.common.math.LongMath;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
@ -15,9 +15,9 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import com.google.bitcoin.crypto.*;
|
import org.bitcoinj.crypto.*;
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.base.Objects.ToStringHelper;
|
import com.google.common.base.Objects.ToStringHelper;
|
||||||
@ -368,7 +368,7 @@ public class ECKey implements EncryptableItem, Serializable {
|
|||||||
/**
|
/**
|
||||||
* Output this ECKey as an ASN.1 encoded private key, as understood by OpenSSL or used by the Bitcoin reference
|
* Output this ECKey as an ASN.1 encoded private key, as understood by OpenSSL or used by the Bitcoin reference
|
||||||
* implementation in its wallet storage format.
|
* implementation in its wallet storage format.
|
||||||
* @throws com.google.bitcoin.core.ECKey.MissingPrivateKeyException if the private key is missing or encrypted.
|
* @throws org.bitcoinj.core.ECKey.MissingPrivateKeyException if the private key is missing or encrypted.
|
||||||
*/
|
*/
|
||||||
public byte[] toASN1() {
|
public byte[] toASN1() {
|
||||||
try {
|
try {
|
||||||
@ -553,7 +553,7 @@ public class ECKey implements EncryptableItem, Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Signs the given hash and returns the R and S components as BigIntegers. In the Bitcoin protocol, they are
|
* Signs the given hash and returns the R and S components as BigIntegers. In the Bitcoin protocol, they are
|
||||||
* usually encoded using ASN.1 format, so you want {@link com.google.bitcoin.core.ECKey.ECDSASignature#toASN1()}
|
* usually encoded using ASN.1 format, so you want {@link org.bitcoinj.core.ECKey.ECDSASignature#toASN1()}
|
||||||
* instead. However sometimes the independent components can be useful, for instance, if you're going to do
|
* instead. However sometimes the independent components can be useful, for instance, if you're going to do
|
||||||
* further EC maths on them.
|
* further EC maths on them.
|
||||||
* @throws KeyCrypterException if this ECKey doesn't have a private part.
|
* @throws KeyCrypterException if this ECKey doesn't have a private part.
|
||||||
@ -572,7 +572,7 @@ public class ECKey implements EncryptableItem, Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Signs the given hash and returns the R and S components as BigIntegers. In the Bitcoin protocol, they are
|
* Signs the given hash and returns the R and S components as BigIntegers. In the Bitcoin protocol, they are
|
||||||
* usually encoded using DER format, so you want {@link com.google.bitcoin.core.ECKey.ECDSASignature#encodeToDER()}
|
* usually encoded using DER format, so you want {@link org.bitcoinj.core.ECKey.ECDSASignature#encodeToDER()}
|
||||||
* instead. However sometimes the independent components can be useful, for instance, if you're doing to do further
|
* instead. However sometimes the independent components can be useful, for instance, if you're doing to do further
|
||||||
* EC maths on them.
|
* EC maths on them.
|
||||||
*
|
*
|
||||||
@ -897,7 +897,7 @@ public class ECKey implements EncryptableItem, Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a 32 byte array containing the private key.
|
* Returns a 32 byte array containing the private key.
|
||||||
* @throws com.google.bitcoin.core.ECKey.MissingPrivateKeyException if the private key bytes are missing/encrypted.
|
* @throws org.bitcoinj.core.ECKey.MissingPrivateKeyException if the private key bytes are missing/encrypted.
|
||||||
*/
|
*/
|
||||||
public byte[] getPrivKeyBytes() {
|
public byte[] getPrivKeyBytes() {
|
||||||
return Utils.bigIntegerToBytes(getPrivKey(), 32);
|
return Utils.bigIntegerToBytes(getPrivKey(), 32);
|
||||||
@ -905,7 +905,7 @@ public class ECKey implements EncryptableItem, Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Exports the private key in the form used by the Satoshi client "dumpprivkey" and "importprivkey" commands. Use
|
* Exports the private key in the form used by the Satoshi client "dumpprivkey" and "importprivkey" commands. Use
|
||||||
* the {@link com.google.bitcoin.core.DumpedPrivateKey#toString()} method to get the string.
|
* the {@link org.bitcoinj.core.DumpedPrivateKey#toString()} method to get the string.
|
||||||
*
|
*
|
||||||
* @param params The network this key is intended for use on.
|
* @param params The network this key is intended for use on.
|
||||||
* @return Private key bytes as a {@link DumpedPrivateKey}.
|
* @return Private key bytes as a {@link DumpedPrivateKey}.
|
@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
@ -15,12 +15,12 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import com.google.bitcoin.script.Script;
|
import org.bitcoinj.script.Script;
|
||||||
import com.google.bitcoin.script.Script.VerifyFlag;
|
import org.bitcoinj.script.Script.VerifyFlag;
|
||||||
import com.google.bitcoin.store.BlockStoreException;
|
import org.bitcoinj.store.BlockStoreException;
|
||||||
import com.google.bitcoin.store.FullPrunedBlockStore;
|
import org.bitcoinj.store.FullPrunedBlockStore;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the "getaddr" P2P protocol message, which requests network {@link AddressMessage}s from a peer. Not to
|
* Represents the "getaddr" P2P protocol message, which requests network {@link AddressMessage}s from a peer. Not to
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the "getdata" P2P network message, which requests the contents of blocks or transactions given their
|
* Represents the "getdata" P2P network message, which requests the contents of blocks or transactions given their
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
public class InventoryItem {
|
public class InventoryItem {
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkArgument;
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
@ -14,9 +14,9 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import com.google.bitcoin.utils.Threading;
|
import org.bitcoinj.utils.Threading;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
@ -15,15 +15,12 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import com.google.bitcoin.params.*;
|
import org.bitcoinj.params.*;
|
||||||
import com.google.bitcoin.script.Script;
|
import org.bitcoinj.script.Script;
|
||||||
import com.google.bitcoin.script.ScriptOpCodes;
|
import org.bitcoinj.script.ScriptOpCodes;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
@ -31,7 +28,7 @@ import java.io.Serializable;
|
|||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static com.google.bitcoin.core.Coin.*;
|
import static org.bitcoinj.core.Coin.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>NetworkParameters contains the data needed for working with an instantiation of a Bitcoin chain.</p>
|
* <p>NetworkParameters contains the data needed for working with an instantiation of a Bitcoin chain.</p>
|
||||||
@ -59,7 +56,7 @@ public abstract class NetworkParameters implements Serializable {
|
|||||||
/** The string returned by getId() for regtest mode. */
|
/** The string returned by getId() for regtest mode. */
|
||||||
public static final String ID_REGTEST = "org.bitcoin.regtest";
|
public static final String ID_REGTEST = "org.bitcoin.regtest";
|
||||||
/** Unit test network. */
|
/** Unit test network. */
|
||||||
public static final String ID_UNITTESTNET = "com.google.bitcoin.unittest";
|
public static final String ID_UNITTESTNET = "org.bitcoinj.unittest";
|
||||||
|
|
||||||
/** The string used by the payment protocol to represent the main net. */
|
/** The string used by the payment protocol to represent the main net. */
|
||||||
public static final String PAYMENT_PROTOCOL_ID_MAINNET = "main";
|
public static final String PAYMENT_PROTOCOL_ID_MAINNET = "main";
|
||||||
@ -285,7 +282,7 @@ public abstract class NetworkParameters implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* First byte of a base58 encoded address. See {@link com.google.bitcoin.core.Address}. This is the same as acceptableAddressCodes[0] and
|
* First byte of a base58 encoded address. See {@link org.bitcoinj.core.Address}. This is the same as acceptableAddressCodes[0] and
|
||||||
* is the one used for "normal" addresses. Other types of address may be encountered with version codes found in
|
* is the one used for "normal" addresses. Other types of address may be encountered with version codes found in
|
||||||
* the acceptableAddressCodes array.
|
* the acceptableAddressCodes array.
|
||||||
*/
|
*/
|
||||||
@ -300,7 +297,7 @@ public abstract class NetworkParameters implements Serializable {
|
|||||||
return p2shHeader;
|
return p2shHeader;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** First byte of a base58 encoded dumped private key. See {@link com.google.bitcoin.core.DumpedPrivateKey}. */
|
/** First byte of a base58 encoded dumped private key. See {@link org.bitcoinj.core.DumpedPrivateKey}. */
|
||||||
public int getDumpedPrivateKeyHeader() {
|
public int getDumpedPrivateKeyHeader() {
|
||||||
return dumpedPrivateKeyHeader;
|
return dumpedPrivateKeyHeader;
|
||||||
}
|
}
|
||||||
@ -341,7 +338,7 @@ public abstract class NetworkParameters implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The key used to sign {@link com.google.bitcoin.core.AlertMessage}s. You can use {@link com.google.bitcoin.core.ECKey#verify(byte[], byte[], byte[])} to verify
|
* The key used to sign {@link org.bitcoinj.core.AlertMessage}s. You can use {@link org.bitcoinj.core.ECKey#verify(byte[], byte[], byte[])} to verify
|
||||||
* signatures using it.
|
* signatures using it.
|
||||||
*/
|
*/
|
||||||
public byte[] getAlertSigningKey() {
|
public byte[] getAlertSigningKey() {
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
@ -23,7 +23,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.google.bitcoin.core.Utils.*;
|
import static org.bitcoinj.core.Utils.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>A data structure that contains proofs of block inclusion for one or more transactions, in an efficient manner.</p>
|
* <p>A data structure that contains proofs of block inclusion for one or more transactions, in an efficient manner.</p>
|
@ -14,12 +14,12 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import com.google.bitcoin.store.BlockStore;
|
import org.bitcoinj.store.BlockStore;
|
||||||
import com.google.bitcoin.store.BlockStoreException;
|
import org.bitcoinj.store.BlockStoreException;
|
||||||
import com.google.bitcoin.utils.ListenerRegistration;
|
import org.bitcoinj.utils.ListenerRegistration;
|
||||||
import com.google.bitcoin.utils.Threading;
|
import org.bitcoinj.utils.Threading;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
@ -47,8 +47,8 @@ import static com.google.common.base.Preconditions.checkState;
|
|||||||
* handles low-level message (de)serialization.</p>
|
* handles low-level message (de)serialization.</p>
|
||||||
*
|
*
|
||||||
* <p>Note that timeouts are handled by the extended
|
* <p>Note that timeouts are handled by the extended
|
||||||
* {@link com.google.bitcoin.net.AbstractTimeoutHandler} and timeout is automatically disabled (using
|
* {@link org.bitcoinj.net.AbstractTimeoutHandler} and timeout is automatically disabled (using
|
||||||
* {@link com.google.bitcoin.net.AbstractTimeoutHandler#setTimeoutEnabled(boolean)}) once the version
|
* {@link org.bitcoinj.net.AbstractTimeoutHandler#setTimeoutEnabled(boolean)}) once the version
|
||||||
* handshake completes.</p>
|
* handshake completes.</p>
|
||||||
*/
|
*/
|
||||||
public class Peer extends PeerSocketHandler {
|
public class Peer extends PeerSocketHandler {
|
||||||
@ -157,9 +157,9 @@ public class Peer extends PeerSocketHandler {
|
|||||||
*
|
*
|
||||||
* <p>Note that this does <b>NOT</b> make a connection to the given remoteAddress, it only creates a handler for a
|
* <p>Note that this does <b>NOT</b> make a connection to the given remoteAddress, it only creates a handler for a
|
||||||
* connection. If you want to create a one-off connection, create a Peer and pass it to
|
* connection. If you want to create a one-off connection, create a Peer and pass it to
|
||||||
* {@link com.google.bitcoin.net.NioClientManager#openConnection(java.net.SocketAddress, com.google.bitcoin.net.StreamParser)}
|
* {@link org.bitcoinj.net.NioClientManager#openConnection(java.net.SocketAddress, org.bitcoinj.net.StreamParser)}
|
||||||
* or
|
* or
|
||||||
* {@link com.google.bitcoin.net.NioClient#NioClient(java.net.SocketAddress, com.google.bitcoin.net.StreamParser, int)}.</p>
|
* {@link org.bitcoinj.net.NioClient#NioClient(java.net.SocketAddress, org.bitcoinj.net.StreamParser, int)}.</p>
|
||||||
*
|
*
|
||||||
* <p>The remoteAddress provided should match the remote address of the peer which is being connected to, and is
|
* <p>The remoteAddress provided should match the remote address of the peer which is being connected to, and is
|
||||||
* used to keep track of which peers relayed transactions and offer more descriptive logging.</p>
|
* used to keep track of which peers relayed transactions and offer more descriptive logging.</p>
|
||||||
@ -175,9 +175,9 @@ public class Peer extends PeerSocketHandler {
|
|||||||
*
|
*
|
||||||
* <p>Note that this does <b>NOT</b> make a connection to the given remoteAddress, it only creates a handler for a
|
* <p>Note that this does <b>NOT</b> make a connection to the given remoteAddress, it only creates a handler for a
|
||||||
* connection. If you want to create a one-off connection, create a Peer and pass it to
|
* connection. If you want to create a one-off connection, create a Peer and pass it to
|
||||||
* {@link com.google.bitcoin.net.NioClientManager#openConnection(java.net.SocketAddress, com.google.bitcoin.net.StreamParser)}
|
* {@link org.bitcoinj.net.NioClientManager#openConnection(java.net.SocketAddress, org.bitcoinj.net.StreamParser)}
|
||||||
* or
|
* or
|
||||||
* {@link com.google.bitcoin.net.NioClient#NioClient(java.net.SocketAddress, com.google.bitcoin.net.StreamParser, int)}.</p>
|
* {@link org.bitcoinj.net.NioClient#NioClient(java.net.SocketAddress, org.bitcoinj.net.StreamParser, int)}.</p>
|
||||||
*
|
*
|
||||||
* <p>The remoteAddress provided should match the remote address of the peer which is being connected to, and is
|
* <p>The remoteAddress provided should match the remote address of the peer which is being connected to, and is
|
||||||
* used to keep track of which peers relayed transactions and offer more descriptive logging.</p>
|
* used to keep track of which peers relayed transactions and offer more descriptive logging.</p>
|
||||||
@ -194,9 +194,9 @@ public class Peer extends PeerSocketHandler {
|
|||||||
*
|
*
|
||||||
* <p>Note that this does <b>NOT</b> make a connection to the given remoteAddress, it only creates a handler for a
|
* <p>Note that this does <b>NOT</b> make a connection to the given remoteAddress, it only creates a handler for a
|
||||||
* connection. If you want to create a one-off connection, create a Peer and pass it to
|
* connection. If you want to create a one-off connection, create a Peer and pass it to
|
||||||
* {@link com.google.bitcoin.net.NioClientManager#openConnection(java.net.SocketAddress, com.google.bitcoin.net.StreamParser)}
|
* {@link org.bitcoinj.net.NioClientManager#openConnection(java.net.SocketAddress, org.bitcoinj.net.StreamParser)}
|
||||||
* or
|
* or
|
||||||
* {@link com.google.bitcoin.net.NioClient#NioClient(java.net.SocketAddress, com.google.bitcoin.net.StreamParser, int)}.</p>
|
* {@link org.bitcoinj.net.NioClient#NioClient(java.net.SocketAddress, org.bitcoinj.net.StreamParser, int)}.</p>
|
||||||
*
|
*
|
||||||
* <p>The remoteAddress provided should match the remote address of the peer which is being connected to, and is
|
* <p>The remoteAddress provided should match the remote address of the peer which is being connected to, and is
|
||||||
* used to keep track of which peers relayed transactions and offer more descriptive logging.</p>
|
* used to keep track of which peers relayed transactions and offer more descriptive logging.</p>
|
||||||
@ -225,9 +225,9 @@ public class Peer extends PeerSocketHandler {
|
|||||||
*
|
*
|
||||||
* <p>Note that this does <b>NOT</b> make a connection to the given remoteAddress, it only creates a handler for a
|
* <p>Note that this does <b>NOT</b> make a connection to the given remoteAddress, it only creates a handler for a
|
||||||
* connection. If you want to create a one-off connection, create a Peer and pass it to
|
* connection. If you want to create a one-off connection, create a Peer and pass it to
|
||||||
* {@link com.google.bitcoin.net.NioClientManager#openConnection(java.net.SocketAddress, com.google.bitcoin.net.StreamParser)}
|
* {@link org.bitcoinj.net.NioClientManager#openConnection(java.net.SocketAddress, org.bitcoinj.net.StreamParser)}
|
||||||
* or
|
* or
|
||||||
* {@link com.google.bitcoin.net.NioClient#NioClient(java.net.SocketAddress, com.google.bitcoin.net.StreamParser, int)}.</p>
|
* {@link org.bitcoinj.net.NioClient#NioClient(java.net.SocketAddress, org.bitcoinj.net.StreamParser, int)}.</p>
|
||||||
*
|
*
|
||||||
* <p>The remoteAddress provided should match the remote address of the peer which is being connected to, and is
|
* <p>The remoteAddress provided should match the remote address of the peer which is being connected to, and is
|
||||||
* used to keep track of which peers relayed transactions and offer more descriptive logging.</p>
|
* used to keep track of which peers relayed transactions and offer more descriptive logging.</p>
|
||||||
@ -1406,7 +1406,7 @@ public class Peer extends PeerSocketHandler {
|
|||||||
/**
|
/**
|
||||||
* Sends the peer a ping message and returns a future that will be invoked when the pong is received back.
|
* Sends the peer a ping message and returns a future that will be invoked when the pong is received back.
|
||||||
* The future provides a number which is the number of milliseconds elapsed between the ping and the pong.
|
* The future provides a number which is the number of milliseconds elapsed between the ping and the pong.
|
||||||
* Once the pong is received the value returned by {@link com.google.bitcoin.core.Peer#getLastPingTime()} is
|
* Once the pong is received the value returned by {@link org.bitcoinj.core.Peer#getLastPingTime()} is
|
||||||
* updated.
|
* updated.
|
||||||
* @throws ProtocolException if the peer version is too low to support measurable pings.
|
* @throws ProtocolException if the peer version is too low to support measurable pings.
|
||||||
*/
|
*/
|
||||||
@ -1425,7 +1425,7 @@ public class Peer extends PeerSocketHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the elapsed time of the last ping/pong cycle. If {@link com.google.bitcoin.core.Peer#ping()} has never
|
* Returns the elapsed time of the last ping/pong cycle. If {@link org.bitcoinj.core.Peer#ping()} has never
|
||||||
* been called or we did not hear back the "pong" message yet, returns {@link Long#MAX_VALUE}.
|
* been called or we did not hear back the "pong" message yet, returns {@link Long#MAX_VALUE}.
|
||||||
*/
|
*/
|
||||||
public long getLastPingTime() {
|
public long getLastPingTime() {
|
||||||
@ -1440,7 +1440,7 @@ public class Peer extends PeerSocketHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a moving average of the last N ping/pong cycles. If {@link com.google.bitcoin.core.Peer#ping()} has never
|
* Returns a moving average of the last N ping/pong cycles. If {@link org.bitcoinj.core.Peer#ping()} has never
|
||||||
* been called or we did not hear back the "pong" message yet, returns {@link Long#MAX_VALUE}. The moving average
|
* been called or we did not hear back the "pong" message yet, returns {@link Long#MAX_VALUE}. The moving average
|
||||||
* window is 5 buckets.
|
* window is 5 buckets.
|
||||||
*/
|
*/
|
@ -14,9 +14,9 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import com.google.bitcoin.params.MainNetParams;
|
import org.bitcoinj.params.MainNetParams;
|
||||||
import com.google.common.net.InetAddresses;
|
import com.google.common.net.InetAddresses;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -26,8 +26,8 @@ import java.net.InetAddress;
|
|||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
|
|
||||||
import static com.google.bitcoin.core.Utils.uint32ToByteStreamLE;
|
import static org.bitcoinj.core.Utils.uint32ToByteStreamLE;
|
||||||
import static com.google.bitcoin.core.Utils.uint64ToByteStreamLE;
|
import static org.bitcoinj.core.Utils.uint64ToByteStreamLE;
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
/**
|
/**
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -70,7 +70,7 @@ public interface PeerEventListener {
|
|||||||
* callback is passed as "m" to the next, forming a chain.</p>
|
* callback is passed as "m" to the next, forming a chain.</p>
|
||||||
*
|
*
|
||||||
* <p>Note that this will never be called if registered with any executor other than
|
* <p>Note that this will never be called if registered with any executor other than
|
||||||
* {@link com.google.bitcoin.utils.Threading#SAME_THREAD}</p>
|
* {@link org.bitcoinj.utils.Threading#SAME_THREAD}</p>
|
||||||
*/
|
*/
|
||||||
public Message onPreMessageReceived(Peer peer, Message m);
|
public Message onPreMessageReceived(Peer peer, Message m);
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ public interface PeerEventListener {
|
|||||||
* items as possible which appear in the {@link GetDataMessage}, or null if you're not interested in responding.</p>
|
* items as possible which appear in the {@link GetDataMessage}, or null if you're not interested in responding.</p>
|
||||||
*
|
*
|
||||||
* <p>Note that this will never be called if registered with any executor other than
|
* <p>Note that this will never be called if registered with any executor other than
|
||||||
* {@link com.google.bitcoin.utils.Threading#SAME_THREAD}</p>
|
* {@link org.bitcoinj.utils.Threading#SAME_THREAD}</p>
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public List<Message> getData(Peer peer, GetDataMessage m);
|
public List<Message> getData(Peer peer, GetDataMessage m);
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thrown when a problem occurs in communicating with a peer, and we should
|
* Thrown when a problem occurs in communicating with a peer, and we should
|
@ -14,13 +14,13 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import java.util.concurrent.locks.Lock;
|
import java.util.concurrent.locks.Lock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An interface which provides the information required to properly filter data downloaded from Peers.
|
* An interface which provides the information required to properly filter data downloaded from Peers.
|
||||||
* Note that an implementer is responsible for calling {@link PeerGroup#recalculateFastCatchupAndFilter(com.google.bitcoin.core.PeerGroup.FilterRecalculateMode)}
|
* Note that an implementer is responsible for calling {@link PeerGroup#recalculateFastCatchupAndFilter(org.bitcoinj.core.PeerGroup.FilterRecalculateMode)}
|
||||||
* whenever a change occurs which effects the data provided via this interface.
|
* whenever a change occurs which effects the data provided via this interface.
|
||||||
*/
|
*/
|
||||||
public interface PeerFilterProvider {
|
public interface PeerFilterProvider {
|
||||||
@ -49,7 +49,7 @@ public interface PeerFilterProvider {
|
|||||||
/**
|
/**
|
||||||
* Returns an object that will be locked before any other methods are called and unlocked afterwards. You must
|
* Returns an object that will be locked before any other methods are called and unlocked afterwards. You must
|
||||||
* provide one of these because the results from calling the above methods must be consistent. Otherwise it's
|
* provide one of these because the results from calling the above methods must be consistent. Otherwise it's
|
||||||
* possible for the {@link com.google.bitcoin.net.FilterMerger} to request the counts of a bunch of providers
|
* possible for the {@link org.bitcoinj.net.FilterMerger} to request the counts of a bunch of providers
|
||||||
* with {@link #getBloomFilterElementCount()}, create a filter of the right size, call {@link #getBloomFilter(int, double, long)}
|
* with {@link #getBloomFilterElementCount()}, create a filter of the right size, call {@link #getBloomFilter(int, double, long)}
|
||||||
* and then the filter provider discovers it's been mutated in the mean time and now has a different number of
|
* and then the filter provider discovers it's been mutated in the mean time and now has a different number of
|
||||||
* elements. For instance, a Wallet that has keys added to it whilst a filter recalc is in progress could cause
|
* elements. For instance, a Wallet that has keys added to it whilst a filter recalc is in progress could cause
|
@ -15,20 +15,20 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import com.google.bitcoin.crypto.DRMWorkaround;
|
import org.bitcoinj.crypto.DRMWorkaround;
|
||||||
import com.google.bitcoin.net.BlockingClientManager;
|
import org.bitcoinj.net.BlockingClientManager;
|
||||||
import com.google.bitcoin.net.ClientConnectionManager;
|
import org.bitcoinj.net.ClientConnectionManager;
|
||||||
import com.google.bitcoin.net.FilterMerger;
|
import org.bitcoinj.net.FilterMerger;
|
||||||
import com.google.bitcoin.net.NioClientManager;
|
import org.bitcoinj.net.NioClientManager;
|
||||||
import com.google.bitcoin.net.discovery.PeerDiscovery;
|
import org.bitcoinj.net.discovery.PeerDiscovery;
|
||||||
import com.google.bitcoin.net.discovery.PeerDiscoveryException;
|
import org.bitcoinj.net.discovery.PeerDiscoveryException;
|
||||||
import com.google.bitcoin.net.discovery.TorDiscovery;
|
import org.bitcoinj.net.discovery.TorDiscovery;
|
||||||
import com.google.bitcoin.script.Script;
|
import org.bitcoinj.script.Script;
|
||||||
import com.google.bitcoin.utils.ExponentialBackoff;
|
import org.bitcoinj.utils.ExponentialBackoff;
|
||||||
import com.google.bitcoin.utils.ListenerRegistration;
|
import org.bitcoinj.utils.ListenerRegistration;
|
||||||
import com.google.bitcoin.utils.Threading;
|
import org.bitcoinj.utils.Threading;
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
@ -982,7 +982,7 @@ public class PeerGroup extends AbstractExecutionThreadService implements Transac
|
|||||||
*
|
*
|
||||||
* @param address destination IP and port.
|
* @param address destination IP and port.
|
||||||
* @return The newly created Peer object or null if the peer could not be connected.
|
* @return The newly created Peer object or null if the peer could not be connected.
|
||||||
* Use {@link com.google.bitcoin.core.Peer#getConnectionOpenFuture()} if you
|
* Use {@link org.bitcoinj.core.Peer#getConnectionOpenFuture()} if you
|
||||||
* want a future which completes when the connection is open.
|
* want a future which completes when the connection is open.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
@ -1349,7 +1349,7 @@ public class PeerGroup extends AbstractExecutionThreadService implements Transac
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a future that is triggered when the number of connected peers is equal to the given number of
|
* Returns a future that is triggered when the number of connected peers is equal to the given number of
|
||||||
* peers. By using this with {@link com.google.bitcoin.core.PeerGroup#getMaxConnections()} you can wait until the
|
* peers. By using this with {@link org.bitcoinj.core.PeerGroup#getMaxConnections()} you can wait until the
|
||||||
* network is fully online. To block immediately, just call get() on the result. Just calls
|
* network is fully online. To block immediately, just call get() on the result. Just calls
|
||||||
* {@link #waitForPeersOfVersion(int, long)} with zero as the protocol version.
|
* {@link #waitForPeersOfVersion(int, long)} with zero as the protocol version.
|
||||||
*
|
*
|
||||||
@ -1407,7 +1407,7 @@ public class PeerGroup extends AbstractExecutionThreadService implements Transac
|
|||||||
* enough, {@link PeerGroup#broadcastTransaction(Transaction)} will wait until the minimum number is reached so
|
* enough, {@link PeerGroup#broadcastTransaction(Transaction)} will wait until the minimum number is reached so
|
||||||
* propagation across the network can be observed. If no value has been set using
|
* propagation across the network can be observed. If no value has been set using
|
||||||
* {@link PeerGroup#setMinBroadcastConnections(int)} a default of half of whatever
|
* {@link PeerGroup#setMinBroadcastConnections(int)} a default of half of whatever
|
||||||
* {@link com.google.bitcoin.core.PeerGroup#getMaxConnections()} returns is used.
|
* {@link org.bitcoinj.core.PeerGroup#getMaxConnections()} returns is used.
|
||||||
*/
|
*/
|
||||||
public int getMinBroadcastConnections() {
|
public int getMinBroadcastConnections() {
|
||||||
lock.lock();
|
lock.lock();
|
||||||
@ -1426,7 +1426,7 @@ public class PeerGroup extends AbstractExecutionThreadService implements Transac
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See {@link com.google.bitcoin.core.PeerGroup#getMinBroadcastConnections()}.
|
* See {@link org.bitcoinj.core.PeerGroup#getMinBroadcastConnections()}.
|
||||||
*/
|
*/
|
||||||
public void setMinBroadcastConnections(int value) {
|
public void setMinBroadcastConnections(int value) {
|
||||||
lock.lock();
|
lock.lock();
|
||||||
@ -1509,7 +1509,7 @@ public class PeerGroup extends AbstractExecutionThreadService implements Transac
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the period between pings for an individual peer. Setting this lower means more accurate and timely ping
|
* Returns the period between pings for an individual peer. Setting this lower means more accurate and timely ping
|
||||||
* times are available via {@link com.google.bitcoin.core.Peer#getLastPingTime()} but it increases load on the
|
* times are available via {@link org.bitcoinj.core.Peer#getLastPingTime()} but it increases load on the
|
||||||
* remote node. It defaults to 5000.
|
* remote node. It defaults to 5000.
|
||||||
*/
|
*/
|
||||||
public long getPingIntervalMsec() {
|
public long getPingIntervalMsec() {
|
||||||
@ -1523,10 +1523,10 @@ public class PeerGroup extends AbstractExecutionThreadService implements Transac
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the period between pings for an individual peer. Setting this lower means more accurate and timely ping
|
* Sets the period between pings for an individual peer. Setting this lower means more accurate and timely ping
|
||||||
* times are available via {@link com.google.bitcoin.core.Peer#getLastPingTime()} but it increases load on the
|
* times are available via {@link org.bitcoinj.core.Peer#getLastPingTime()} but it increases load on the
|
||||||
* remote node. It defaults to {@link PeerGroup#DEFAULT_PING_INTERVAL_MSEC}.
|
* remote node. It defaults to {@link PeerGroup#DEFAULT_PING_INTERVAL_MSEC}.
|
||||||
* Setting the value to be <= 0 disables pinging entirely, although you can still request one yourself
|
* Setting the value to be <= 0 disables pinging entirely, although you can still request one yourself
|
||||||
* using {@link com.google.bitcoin.core.Peer#ping()}.
|
* using {@link org.bitcoinj.core.Peer#ping()}.
|
||||||
*/
|
*/
|
||||||
public void setPingIntervalMsec(long pingIntervalMsec) {
|
public void setPingIntervalMsec(long pingIntervalMsec) {
|
||||||
lock.lock();
|
lock.lock();
|
@ -14,12 +14,12 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import com.google.bitcoin.net.AbstractTimeoutHandler;
|
import org.bitcoinj.net.AbstractTimeoutHandler;
|
||||||
import com.google.bitcoin.net.MessageWriteTarget;
|
import org.bitcoinj.net.MessageWriteTarget;
|
||||||
import com.google.bitcoin.net.StreamParser;
|
import org.bitcoinj.net.StreamParser;
|
||||||
import com.google.bitcoin.utils.Threading;
|
import org.bitcoinj.utils.Threading;
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -37,7 +37,7 @@ import static com.google.common.base.Preconditions.*;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles high-level message (de)serialization for peers, acting as the bridge between the
|
* Handles high-level message (de)serialization for peers, acting as the bridge between the
|
||||||
* {@link com.google.bitcoin.net} classes and {@link Peer}.
|
* {@link org.bitcoinj.net} classes and {@link Peer}.
|
||||||
*/
|
*/
|
||||||
public abstract class PeerSocketHandler extends AbstractTimeoutHandler implements StreamParser {
|
public abstract class PeerSocketHandler extends AbstractTimeoutHandler implements StreamParser {
|
||||||
private static final Logger log = LoggerFactory.getLogger(PeerSocketHandler.class);
|
private static final Logger log = LoggerFactory.getLogger(PeerSocketHandler.class);
|
||||||
@ -185,8 +185,8 @@ public abstract class PeerSocketHandler extends AbstractTimeoutHandler implement
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the {@link MessageWriteTarget} used to write messages to the peer. This should almost never be called, it is
|
* Sets the {@link MessageWriteTarget} used to write messages to the peer. This should almost never be called, it is
|
||||||
* called automatically by {@link com.google.bitcoin.net.NioClient} or
|
* called automatically by {@link org.bitcoinj.net.NioClient} or
|
||||||
* {@link com.google.bitcoin.net.NioClientManager} once the socket finishes initialization.
|
* {@link org.bitcoinj.net.NioClientManager} once the socket finishes initialization.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setWriteTarget(MessageWriteTarget writeTarget) {
|
public void setWriteTarget(MessageWriteTarget writeTarget) {
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class ProtocolException extends VerificationException {
|
public class ProtocolException extends VerificationException {
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
// TODO: Rename PrunedException to something like RequiredDataWasPrunedException
|
// TODO: Rename PrunedException to something like RequiredDataWasPrunedException
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class ScriptException extends VerificationException {
|
public class ScriptException extends VerificationException {
|
@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import com.google.common.io.ByteStreams;
|
import com.google.common.io.ByteStreams;
|
||||||
|
|
@ -14,10 +14,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import com.google.bitcoin.store.BlockStore;
|
import org.bitcoinj.store.BlockStore;
|
||||||
import com.google.bitcoin.store.BlockStoreException;
|
import org.bitcoinj.store.BlockStoreException;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
@ -15,15 +15,15 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import com.google.bitcoin.core.TransactionConfidence.ConfidenceType;
|
import org.bitcoinj.core.TransactionConfidence.ConfidenceType;
|
||||||
import com.google.bitcoin.crypto.TransactionSignature;
|
import org.bitcoinj.crypto.TransactionSignature;
|
||||||
import com.google.bitcoin.script.Script;
|
import org.bitcoinj.script.Script;
|
||||||
import com.google.bitcoin.script.ScriptBuilder;
|
import org.bitcoinj.script.ScriptBuilder;
|
||||||
import com.google.bitcoin.script.ScriptOpCodes;
|
import org.bitcoinj.script.ScriptOpCodes;
|
||||||
import com.google.bitcoin.utils.ExchangeRate;
|
import org.bitcoinj.utils.ExchangeRate;
|
||||||
import com.google.bitcoin.wallet.WalletTransaction.Pool;
|
import org.bitcoinj.wallet.WalletTransaction.Pool;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.primitives.Ints;
|
import com.google.common.primitives.Ints;
|
||||||
import com.google.common.primitives.Longs;
|
import com.google.common.primitives.Longs;
|
||||||
@ -36,7 +36,7 @@ import java.text.ParseException;
|
|||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static com.google.bitcoin.core.Utils.*;
|
import static org.bitcoinj.core.Utils.*;
|
||||||
import static com.google.common.base.Preconditions.checkState;
|
import static com.google.common.base.Preconditions.checkState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -772,7 +772,7 @@ public class Transaction extends ChildMessage implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Same as {@link #addSignedInput(TransactionOutPoint, com.google.bitcoin.script.Script, ECKey, com.google.bitcoin.core.Transaction.SigHash, boolean)}
|
* Same as {@link #addSignedInput(TransactionOutPoint, org.bitcoinj.script.Script, ECKey, org.bitcoinj.core.Transaction.SigHash, boolean)}
|
||||||
* but defaults to {@link SigHash#ALL} and "false" for the anyoneCanPay flag. This is normally what you want.
|
* but defaults to {@link SigHash#ALL} and "false" for the anyoneCanPay flag. This is normally what you want.
|
||||||
*/
|
*/
|
||||||
public TransactionInput addSignedInput(TransactionOutPoint prevOut, Script scriptPubKey, ECKey sigKey) throws ScriptException {
|
public TransactionInput addSignedInput(TransactionOutPoint prevOut, Script scriptPubKey, ECKey sigKey) throws ScriptException {
|
||||||
@ -846,7 +846,7 @@ public class Transaction extends ChildMessage implements Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculates a signature that is valid for being inserted into the input at the given position. This is simply
|
* Calculates a signature that is valid for being inserted into the input at the given position. This is simply
|
||||||
* a wrapper around calling {@link Transaction#hashForSignature(int, byte[], com.google.bitcoin.core.Transaction.SigHash, boolean)}
|
* a wrapper around calling {@link Transaction#hashForSignature(int, byte[], org.bitcoinj.core.Transaction.SigHash, boolean)}
|
||||||
* followed by {@link ECKey#sign(Sha256Hash)} and then returning a new {@link TransactionSignature}. The key
|
* followed by {@link ECKey#sign(Sha256Hash)} and then returning a new {@link TransactionSignature}. The key
|
||||||
* must be usable for signing as-is: if the key is encrypted it must be decrypted first external to this method.
|
* must be usable for signing as-is: if the key is encrypted it must be decrypted first external to this method.
|
||||||
*
|
*
|
||||||
@ -866,7 +866,7 @@ public class Transaction extends ChildMessage implements Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculates a signature that is valid for being inserted into the input at the given position. This is simply
|
* Calculates a signature that is valid for being inserted into the input at the given position. This is simply
|
||||||
* a wrapper around calling {@link Transaction#hashForSignature(int, byte[], com.google.bitcoin.core.Transaction.SigHash, boolean)}
|
* a wrapper around calling {@link Transaction#hashForSignature(int, byte[], org.bitcoinj.core.Transaction.SigHash, boolean)}
|
||||||
* followed by {@link ECKey#sign(Sha256Hash)} and then returning a new {@link TransactionSignature}.
|
* followed by {@link ECKey#sign(Sha256Hash)} and then returning a new {@link TransactionSignature}.
|
||||||
*
|
*
|
||||||
* @param inputIndex Which input to calculate the signature for, as an index.
|
* @param inputIndex Which input to calculate the signature for, as an index.
|
@ -14,15 +14,15 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import com.google.bitcoin.script.Script;
|
import org.bitcoinj.script.Script;
|
||||||
import com.google.bitcoin.wallet.WalletTransaction;
|
import org.bitcoinj.wallet.WalletTransaction;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface is used to abstract the {@link com.google.bitcoin.core.Wallet} and the {@link com.google.bitcoin.core.Transaction}
|
* This interface is used to abstract the {@link org.bitcoinj.core.Wallet} and the {@link org.bitcoinj.core.Transaction}
|
||||||
*/
|
*/
|
||||||
public interface TransactionBag {
|
public interface TransactionBag {
|
||||||
/** Returns true if this wallet contains a public key which hashes to the given hash. */
|
/** Returns true if this wallet contains a public key which hashes to the given hash. */
|
@ -14,9 +14,9 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import com.google.bitcoin.utils.Threading;
|
import org.bitcoinj.utils.Threading;
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
@ -14,13 +14,13 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A general interface which declares the ability to broadcast transactions. This is implemented
|
* A general interface which declares the ability to broadcast transactions. This is implemented
|
||||||
* by {@link com.google.bitcoin.core.PeerGroup}.
|
* by {@link org.bitcoinj.core.PeerGroup}.
|
||||||
*/
|
*/
|
||||||
public interface TransactionBroadcaster {
|
public interface TransactionBroadcaster {
|
||||||
/** Broadcast the given transaction on the network */
|
/** Broadcast the given transaction on the network */
|
@ -15,16 +15,15 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import com.google.bitcoin.utils.ListenerRegistration;
|
import org.bitcoinj.utils.ListenerRegistration;
|
||||||
import com.google.bitcoin.utils.Threading;
|
import org.bitcoinj.utils.Threading;
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
import com.google.common.util.concurrent.SettableFuture;
|
import com.google.common.util.concurrent.SettableFuture;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigInteger;
|
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
@ -55,9 +54,9 @@ import static com.google.common.base.Preconditions.*;
|
|||||||
* <p>Alternatively, you may know that the transaction is "dead", that is, one or more of its inputs have
|
* <p>Alternatively, you may know that the transaction is "dead", that is, one or more of its inputs have
|
||||||
* been double spent and will never confirm unless there is another re-org.</p>
|
* been double spent and will never confirm unless there is another re-org.</p>
|
||||||
*
|
*
|
||||||
* <p>TransactionConfidence is updated via the {@link com.google.bitcoin.core.TransactionConfidence#incrementDepthInBlocks()}
|
* <p>TransactionConfidence is updated via the {@link org.bitcoinj.core.TransactionConfidence#incrementDepthInBlocks()}
|
||||||
* method to ensure the block depth is up to date.</p>
|
* method to ensure the block depth is up to date.</p>
|
||||||
* To make a copy that won't be changed, use {@link com.google.bitcoin.core.TransactionConfidence#duplicate()}.
|
* To make a copy that won't be changed, use {@link org.bitcoinj.core.TransactionConfidence#duplicate()}.
|
||||||
*/
|
*/
|
||||||
public class TransactionConfidence implements Serializable {
|
public class TransactionConfidence implements Serializable {
|
||||||
private static final long serialVersionUID = 4577920141400556444L;
|
private static final long serialVersionUID = 4577920141400556444L;
|
||||||
@ -86,7 +85,7 @@ public class TransactionConfidence implements Serializable {
|
|||||||
* announced and is considered valid by the network. A pending transaction will be announced if the containing
|
* announced and is considered valid by the network. A pending transaction will be announced if the containing
|
||||||
* wallet has been attached to a live {@link PeerGroup} using {@link PeerGroup#addWallet(Wallet)}.
|
* wallet has been attached to a live {@link PeerGroup} using {@link PeerGroup#addWallet(Wallet)}.
|
||||||
* You can estimate how likely the transaction is to be included by connecting to a bunch of nodes then measuring
|
* You can estimate how likely the transaction is to be included by connecting to a bunch of nodes then measuring
|
||||||
* how many announce it, using {@link com.google.bitcoin.core.TransactionConfidence#numBroadcastPeers()}.
|
* how many announce it, using {@link org.bitcoinj.core.TransactionConfidence#numBroadcastPeers()}.
|
||||||
* Or if you saw it from a trusted peer, you can assume it's valid and will get mined sooner or later as well.
|
* Or if you saw it from a trusted peer, you can assume it's valid and will get mined sooner or later as well.
|
||||||
*/
|
*/
|
||||||
PENDING(2),
|
PENDING(2),
|
||||||
@ -154,7 +153,7 @@ public class TransactionConfidence implements Serializable {
|
|||||||
/** An enum that describes why a transaction confidence listener is being invoked (i.e. the class of change). */
|
/** An enum that describes why a transaction confidence listener is being invoked (i.e. the class of change). */
|
||||||
public enum ChangeReason {
|
public enum ChangeReason {
|
||||||
/**
|
/**
|
||||||
* Occurs when the type returned by {@link com.google.bitcoin.core.TransactionConfidence#getConfidenceType()}
|
* Occurs when the type returned by {@link org.bitcoinj.core.TransactionConfidence#getConfidenceType()}
|
||||||
* has changed. For example, if a PENDING transaction changes to BUILDING or DEAD, then this reason will
|
* has changed. For example, if a PENDING transaction changes to BUILDING or DEAD, then this reason will
|
||||||
* be given. It's a high level summary.
|
* be given. It's a high level summary.
|
||||||
*/
|
*/
|
||||||
@ -411,7 +410,7 @@ public class TransactionConfidence implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* The source of a transaction tries to identify where it came from originally. For instance, did we download it
|
* The source of a transaction tries to identify where it came from originally. For instance, did we download it
|
||||||
* from the peer to peer network, or make it ourselves, or receive it via Bluetooth, or import it from another app,
|
* from the peer to peer network, or make it ourselves, or receive it via Bluetooth, or import it from another app,
|
||||||
* and so on. This information is useful for {@link com.google.bitcoin.wallet.CoinSelector} implementations to risk analyze
|
* and so on. This information is useful for {@link org.bitcoinj.wallet.CoinSelector} implementations to risk analyze
|
||||||
* transactions and decide when to spend them.
|
* transactions and decide when to spend them.
|
||||||
*/
|
*/
|
||||||
public synchronized Source getSource() {
|
public synchronized Source getSource() {
|
||||||
@ -421,7 +420,7 @@ public class TransactionConfidence implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* The source of a transaction tries to identify where it came from originally. For instance, did we download it
|
* The source of a transaction tries to identify where it came from originally. For instance, did we download it
|
||||||
* from the peer to peer network, or make it ourselves, or receive it via Bluetooth, or import it from another app,
|
* from the peer to peer network, or make it ourselves, or receive it via Bluetooth, or import it from another app,
|
||||||
* and so on. This information is useful for {@link com.google.bitcoin.wallet.CoinSelector} implementations to risk analyze
|
* and so on. This information is useful for {@link org.bitcoinj.wallet.CoinSelector} implementations to risk analyze
|
||||||
* transactions and decide when to spend them.
|
* transactions and decide when to spend them.
|
||||||
*/
|
*/
|
||||||
public synchronized void setSource(Source source) {
|
public synchronized void setSource(Source source) {
|
@ -15,11 +15,11 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import com.google.bitcoin.script.Script;
|
import org.bitcoinj.script.Script;
|
||||||
import com.google.bitcoin.wallet.KeyBag;
|
import org.bitcoinj.wallet.KeyBag;
|
||||||
import com.google.bitcoin.wallet.RedeemData;
|
import org.bitcoinj.wallet.RedeemData;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -307,7 +307,7 @@ public class TransactionInput extends ChildMessage implements Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Alias for getOutpoint().getConnectedRedeemData(keyBag)
|
* Alias for getOutpoint().getConnectedRedeemData(keyBag)
|
||||||
* @see TransactionOutPoint#getConnectedRedeemData(com.google.bitcoin.wallet.KeyBag)
|
* @see TransactionOutPoint#getConnectedRedeemData(org.bitcoinj.wallet.KeyBag)
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public RedeemData getConnectedRedeemData(KeyBag keyBag) throws ScriptException {
|
public RedeemData getConnectedRedeemData(KeyBag keyBag) throws ScriptException {
|
@ -14,11 +14,11 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import com.google.bitcoin.script.Script;
|
import org.bitcoinj.script.Script;
|
||||||
import com.google.bitcoin.wallet.KeyBag;
|
import org.bitcoinj.wallet.KeyBag;
|
||||||
import com.google.bitcoin.wallet.RedeemData;
|
import org.bitcoinj.wallet.RedeemData;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -136,7 +136,7 @@ public class TransactionOutPoint extends ChildMessage implements Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the ECKey identified in the connected output, for either pay-to-address scripts or pay-to-key scripts.
|
* Returns the ECKey identified in the connected output, for either pay-to-address scripts or pay-to-key scripts.
|
||||||
* For P2SH scripts you can use {@link #getConnectedRedeemData(com.google.bitcoin.wallet.KeyBag)} and then get the
|
* For P2SH scripts you can use {@link #getConnectedRedeemData(org.bitcoinj.wallet.KeyBag)} and then get the
|
||||||
* key from RedeemData.
|
* key from RedeemData.
|
||||||
* If the script form cannot be understood, throws ScriptException.
|
* If the script form cannot be understood, throws ScriptException.
|
||||||
*
|
*
|
@ -15,10 +15,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import com.google.bitcoin.script.Script;
|
import org.bitcoinj.script.Script;
|
||||||
import com.google.bitcoin.script.ScriptBuilder;
|
import org.bitcoinj.script.ScriptBuilder;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -234,7 +234,7 @@ public class TransactionOutput extends ChildMessage implements Serializable {
|
|||||||
* so we call them "dust outputs" and they're made non standard. The choice of one third is somewhat arbitrary and
|
* so we call them "dust outputs" and they're made non standard. The choice of one third is somewhat arbitrary and
|
||||||
* may change in future.</p>
|
* may change in future.</p>
|
||||||
*
|
*
|
||||||
* <p>You probably should use {@link com.google.bitcoin.core.TransactionOutput#getMinNonDustValue()} which uses
|
* <p>You probably should use {@link org.bitcoinj.core.TransactionOutput#getMinNonDustValue()} which uses
|
||||||
* a safe fee-per-kb by default.</p>
|
* a safe fee-per-kb by default.</p>
|
||||||
*
|
*
|
||||||
* @param feePerKbRequired The fee required per kilobyte. Note that this is the same as the reference client's -minrelaytxfee * 3
|
* @param feePerKbRequired The fee required per kilobyte. Note that this is the same as the reference client's -minrelaytxfee * 3
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
@ -13,13 +13,12 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.BitSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/** Message representing a list of unspent transaction outputs, returned in response to sending a GetUTXOsMessage. */
|
/** Message representing a list of unspent transaction outputs, returned in response to sending a GetUTXOsMessage. */
|
@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
public class UnknownMessage extends EmptyMessage {
|
public class UnknownMessage extends EmptyMessage {
|
||||||
private static final long serialVersionUID = 3614705938207918775L;
|
private static final long serialVersionUID = 3614705938207918775L;
|
@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import com.google.common.base.Charsets;
|
import com.google.common.base.Charsets;
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
@ -14,10 +14,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import static com.google.bitcoin.core.Utils.isLessThanUnsigned;
|
import static org.bitcoinj.core.Utils.isLessThanUnsigned;
|
||||||
import static com.google.bitcoin.core.Utils.isLessThanOrEqualToUnsigned;
|
import static org.bitcoinj.core.Utils.isLessThanOrEqualToUnsigned;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A variable-length encoded integer using Satoshis encoding.
|
* A variable-length encoded integer using Satoshis encoding.
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class VerificationException extends RuntimeException {
|
public class VerificationException extends RuntimeException {
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The verack message, sent by a client accepting the version message they
|
* The verack message, sent by a client accepting the version message they
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
@ -14,15 +14,13 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkArgument;
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import org.spongycastle.util.Integers;
|
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
@ -15,25 +15,25 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import com.google.bitcoin.core.TransactionConfidence.ConfidenceType;
|
import org.bitcoinj.core.TransactionConfidence.ConfidenceType;
|
||||||
import com.google.bitcoin.crypto.*;
|
import org.bitcoinj.crypto.*;
|
||||||
import com.google.bitcoin.params.UnitTestParams;
|
import org.bitcoinj.params.UnitTestParams;
|
||||||
import com.google.bitcoin.script.Script;
|
import org.bitcoinj.script.Script;
|
||||||
import com.google.bitcoin.script.ScriptBuilder;
|
import org.bitcoinj.script.ScriptBuilder;
|
||||||
import com.google.bitcoin.script.ScriptChunk;
|
import org.bitcoinj.script.ScriptChunk;
|
||||||
import com.google.bitcoin.signers.MissingSigResolutionSigner;
|
import org.bitcoinj.signers.MissingSigResolutionSigner;
|
||||||
import com.google.bitcoin.signers.LocalTransactionSigner;
|
import org.bitcoinj.signers.LocalTransactionSigner;
|
||||||
import com.google.bitcoin.signers.TransactionSigner;
|
import org.bitcoinj.signers.TransactionSigner;
|
||||||
import com.google.bitcoin.store.UnreadableWalletException;
|
import org.bitcoinj.store.UnreadableWalletException;
|
||||||
import com.google.bitcoin.store.WalletProtobufSerializer;
|
import org.bitcoinj.store.WalletProtobufSerializer;
|
||||||
import com.google.bitcoin.utils.BaseTaggableObject;
|
import org.bitcoinj.utils.BaseTaggableObject;
|
||||||
import com.google.bitcoin.utils.ExchangeRate;
|
import org.bitcoinj.utils.ExchangeRate;
|
||||||
import com.google.bitcoin.utils.ListenerRegistration;
|
import org.bitcoinj.utils.ListenerRegistration;
|
||||||
import com.google.bitcoin.utils.Threading;
|
import org.bitcoinj.utils.Threading;
|
||||||
import com.google.bitcoin.wallet.*;
|
import org.bitcoinj.wallet.*;
|
||||||
import com.google.bitcoin.wallet.WalletTransaction.Pool;
|
import org.bitcoinj.wallet.WalletTransaction.Pool;
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.base.Objects.ToStringHelper;
|
import com.google.common.base.Objects.ToStringHelper;
|
||||||
@ -46,7 +46,6 @@ import com.google.common.util.concurrent.SettableFuture;
|
|||||||
import com.google.protobuf.ByteString;
|
import com.google.protobuf.ByteString;
|
||||||
|
|
||||||
import org.bitcoin.protocols.payments.Protos.PaymentDetails;
|
import org.bitcoin.protocols.payments.Protos.PaymentDetails;
|
||||||
import org.bitcoinj.wallet.Protos;
|
|
||||||
import org.bitcoinj.wallet.Protos.Wallet.EncryptionType;
|
import org.bitcoinj.wallet.Protos.Wallet.EncryptionType;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -99,7 +98,7 @@ import static com.google.common.base.Preconditions.*;
|
|||||||
* that simplifies this for you although you're still responsible for manually triggering a save when your app is about
|
* that simplifies this for you although you're still responsible for manually triggering a save when your app is about
|
||||||
* to quit because the auto-save feature waits a moment before actually committing to disk to avoid IO thrashing when
|
* to quit because the auto-save feature waits a moment before actually committing to disk to avoid IO thrashing when
|
||||||
* the wallet is changing very fast (eg due to a block chain sync). See
|
* the wallet is changing very fast (eg due to a block chain sync). See
|
||||||
* {@link Wallet#autosaveToFile(java.io.File, long, java.util.concurrent.TimeUnit, com.google.bitcoin.wallet.WalletFiles.Listener)}
|
* {@link Wallet#autosaveToFile(java.io.File, long, java.util.concurrent.TimeUnit, org.bitcoinj.wallet.WalletFiles.Listener)}
|
||||||
* for more information about this.</p>
|
* for more information about this.</p>
|
||||||
*/
|
*/
|
||||||
public class Wallet extends BaseTaggableObject implements Serializable, BlockChainListener, PeerFilterProvider, KeyBag, TransactionBag {
|
public class Wallet extends BaseTaggableObject implements Serializable, BlockChainListener, PeerFilterProvider, KeyBag, TransactionBag {
|
||||||
@ -342,7 +341,7 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
|
|||||||
/**
|
/**
|
||||||
* Returns a key that hasn't been seen in a transaction yet, and which is suitable for displaying in a wallet
|
* Returns a key that hasn't been seen in a transaction yet, and which is suitable for displaying in a wallet
|
||||||
* user interface as "a convenient key to receive funds on" when the purpose parameter is
|
* user interface as "a convenient key to receive funds on" when the purpose parameter is
|
||||||
* {@link com.google.bitcoin.wallet.KeyChain.KeyPurpose#RECEIVE_FUNDS}. The returned key is stable until
|
* {@link org.bitcoinj.wallet.KeyChain.KeyPurpose#RECEIVE_FUNDS}. The returned key is stable until
|
||||||
* it's actually seen in a pending or confirmed transaction, at which point this method will start returning
|
* it's actually seen in a pending or confirmed transaction, at which point this method will start returning
|
||||||
* a different key (for each purpose independently).
|
* a different key (for each purpose independently).
|
||||||
*/
|
*/
|
||||||
@ -357,15 +356,15 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An alias for calling {@link #currentKey(com.google.bitcoin.wallet.KeyChain.KeyPurpose)} with
|
* An alias for calling {@link #currentKey(org.bitcoinj.wallet.KeyChain.KeyPurpose)} with
|
||||||
* {@link com.google.bitcoin.wallet.KeyChain.KeyPurpose#RECEIVE_FUNDS} as the parameter.
|
* {@link org.bitcoinj.wallet.KeyChain.KeyPurpose#RECEIVE_FUNDS} as the parameter.
|
||||||
*/
|
*/
|
||||||
public DeterministicKey currentReceiveKey() {
|
public DeterministicKey currentReceiveKey() {
|
||||||
return currentKey(KeyChain.KeyPurpose.RECEIVE_FUNDS);
|
return currentKey(KeyChain.KeyPurpose.RECEIVE_FUNDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns address for a {@link #currentKey(com.google.bitcoin.wallet.KeyChain.KeyPurpose)}
|
* Returns address for a {@link #currentKey(org.bitcoinj.wallet.KeyChain.KeyPurpose)}
|
||||||
*/
|
*/
|
||||||
public Address currentAddress(KeyChain.KeyPurpose purpose) {
|
public Address currentAddress(KeyChain.KeyPurpose purpose) {
|
||||||
lock.lock();
|
lock.lock();
|
||||||
@ -378,8 +377,8 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An alias for calling {@link #currentAddress(com.google.bitcoin.wallet.KeyChain.KeyPurpose)} with
|
* An alias for calling {@link #currentAddress(org.bitcoinj.wallet.KeyChain.KeyPurpose)} with
|
||||||
* {@link com.google.bitcoin.wallet.KeyChain.KeyPurpose#RECEIVE_FUNDS} as the parameter.
|
* {@link org.bitcoinj.wallet.KeyChain.KeyPurpose#RECEIVE_FUNDS} as the parameter.
|
||||||
*/
|
*/
|
||||||
public Address currentReceiveAddress() {
|
public Address currentReceiveAddress() {
|
||||||
return currentAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS);
|
return currentAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS);
|
||||||
@ -388,8 +387,8 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
|
|||||||
/**
|
/**
|
||||||
* Returns a key that has not been returned by this method before (fresh). You can think of this as being
|
* Returns a key that has not been returned by this method before (fresh). You can think of this as being
|
||||||
* a newly created key, although the notion of "create" is not really valid for a
|
* a newly created key, although the notion of "create" is not really valid for a
|
||||||
* {@link com.google.bitcoin.wallet.DeterministicKeyChain}. When the parameter is
|
* {@link org.bitcoinj.wallet.DeterministicKeyChain}. When the parameter is
|
||||||
* {@link com.google.bitcoin.wallet.KeyChain.KeyPurpose#RECEIVE_FUNDS} the returned key is suitable for being put
|
* {@link org.bitcoinj.wallet.KeyChain.KeyPurpose#RECEIVE_FUNDS} the returned key is suitable for being put
|
||||||
* into a receive coins wizard type UI. You should use this when the user is definitely going to hand this key out
|
* into a receive coins wizard type UI. You should use this when the user is definitely going to hand this key out
|
||||||
* to someone who wishes to send money.
|
* to someone who wishes to send money.
|
||||||
*/
|
*/
|
||||||
@ -400,8 +399,8 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
|
|||||||
/**
|
/**
|
||||||
* Returns a key/s that has not been returned by this method before (fresh). You can think of this as being
|
* Returns a key/s that has not been returned by this method before (fresh). You can think of this as being
|
||||||
* a newly created key/s, although the notion of "create" is not really valid for a
|
* a newly created key/s, although the notion of "create" is not really valid for a
|
||||||
* {@link com.google.bitcoin.wallet.DeterministicKeyChain}. When the parameter is
|
* {@link org.bitcoinj.wallet.DeterministicKeyChain}. When the parameter is
|
||||||
* {@link com.google.bitcoin.wallet.KeyChain.KeyPurpose#RECEIVE_FUNDS} the returned key is suitable for being put
|
* {@link org.bitcoinj.wallet.KeyChain.KeyPurpose#RECEIVE_FUNDS} the returned key is suitable for being put
|
||||||
* into a receive coins wizard type UI. You should use this when the user is definitely going to hand this key/s out
|
* into a receive coins wizard type UI. You should use this when the user is definitely going to hand this key/s out
|
||||||
* to someone who wishes to send money.
|
* to someone who wishes to send money.
|
||||||
*/
|
*/
|
||||||
@ -420,15 +419,15 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An alias for calling {@link #freshKey(com.google.bitcoin.wallet.KeyChain.KeyPurpose)} with
|
* An alias for calling {@link #freshKey(org.bitcoinj.wallet.KeyChain.KeyPurpose)} with
|
||||||
* {@link com.google.bitcoin.wallet.KeyChain.KeyPurpose#RECEIVE_FUNDS} as the parameter.
|
* {@link org.bitcoinj.wallet.KeyChain.KeyPurpose#RECEIVE_FUNDS} as the parameter.
|
||||||
*/
|
*/
|
||||||
public DeterministicKey freshReceiveKey() {
|
public DeterministicKey freshReceiveKey() {
|
||||||
return freshKey(KeyChain.KeyPurpose.RECEIVE_FUNDS);
|
return freshKey(KeyChain.KeyPurpose.RECEIVE_FUNDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns address for a {@link #freshKey(com.google.bitcoin.wallet.KeyChain.KeyPurpose)}
|
* Returns address for a {@link #freshKey(org.bitcoinj.wallet.KeyChain.KeyPurpose)}
|
||||||
*/
|
*/
|
||||||
public Address freshAddress(KeyChain.KeyPurpose purpose) {
|
public Address freshAddress(KeyChain.KeyPurpose purpose) {
|
||||||
lock.lock();
|
lock.lock();
|
||||||
@ -442,8 +441,8 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An alias for calling {@link #freshAddress(com.google.bitcoin.wallet.KeyChain.KeyPurpose)} with
|
* An alias for calling {@link #freshAddress(org.bitcoinj.wallet.KeyChain.KeyPurpose)} with
|
||||||
* {@link com.google.bitcoin.wallet.KeyChain.KeyPurpose#RECEIVE_FUNDS} as the parameter.
|
* {@link org.bitcoinj.wallet.KeyChain.KeyPurpose#RECEIVE_FUNDS} as the parameter.
|
||||||
*/
|
*/
|
||||||
public Address freshReceiveAddress() {
|
public Address freshReceiveAddress() {
|
||||||
return freshAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS);
|
return freshAddress(KeyChain.KeyPurpose.RECEIVE_FUNDS);
|
||||||
@ -582,7 +581,7 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Imports the given keys to the wallet.
|
* Imports the given keys to the wallet.
|
||||||
* If {@link Wallet#autosaveToFile(java.io.File, long, java.util.concurrent.TimeUnit, com.google.bitcoin.wallet.WalletFiles.Listener)}
|
* If {@link Wallet#autosaveToFile(java.io.File, long, java.util.concurrent.TimeUnit, org.bitcoinj.wallet.WalletFiles.Listener)}
|
||||||
* has been called, triggers an auto save bypassing the normal coalescing delay and event handlers.
|
* has been called, triggers an auto save bypassing the normal coalescing delay and event handlers.
|
||||||
* Returns the number of keys added, after duplicates are ignored. The onKeyAdded event will be called for each key
|
* Returns the number of keys added, after duplicates are ignored. The onKeyAdded event will be called for each key
|
||||||
* in the list that was not already present.
|
* in the list that was not already present.
|
||||||
@ -664,7 +663,7 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** See {@link com.google.bitcoin.wallet.DeterministicKeyChain#setLookaheadSize(int)} for more info on this. */
|
/** See {@link org.bitcoinj.wallet.DeterministicKeyChain#setLookaheadSize(int)} for more info on this. */
|
||||||
public void setKeychainLookaheadSize(int lookaheadSize) {
|
public void setKeychainLookaheadSize(int lookaheadSize) {
|
||||||
lock.lock();
|
lock.lock();
|
||||||
try {
|
try {
|
||||||
@ -674,12 +673,12 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** See {@link com.google.bitcoin.wallet.DeterministicKeyChain#setLookaheadSize(int)} for more info on this. */
|
/** See {@link org.bitcoinj.wallet.DeterministicKeyChain#setLookaheadSize(int)} for more info on this. */
|
||||||
public int getKeychainLookaheadSize() {
|
public int getKeychainLookaheadSize() {
|
||||||
return keychain.getLookaheadSize();
|
return keychain.getLookaheadSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** See {@link com.google.bitcoin.wallet.DeterministicKeyChain#setLookaheadThreshold(int)} for more info on this. */
|
/** See {@link org.bitcoinj.wallet.DeterministicKeyChain#setLookaheadThreshold(int)} for more info on this. */
|
||||||
public void setKeychainLookaheadThreshold(int num) {
|
public void setKeychainLookaheadThreshold(int num) {
|
||||||
lock.lock();
|
lock.lock();
|
||||||
try {
|
try {
|
||||||
@ -690,7 +689,7 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** See {@link com.google.bitcoin.wallet.DeterministicKeyChain#setLookaheadThreshold(int)} for more info on this. */
|
/** See {@link org.bitcoinj.wallet.DeterministicKeyChain#setLookaheadThreshold(int)} for more info on this. */
|
||||||
public int getKeychainLookaheadThreshold() {
|
public int getKeychainLookaheadThreshold() {
|
||||||
lock.lock();
|
lock.lock();
|
||||||
try {
|
try {
|
||||||
@ -890,7 +889,7 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Marks all keys used in the transaction output as used in the wallet.
|
* Marks all keys used in the transaction output as used in the wallet.
|
||||||
* See {@link com.google.bitcoin.wallet.DeterministicKeyChain#markKeyAsUsed(DeterministicKey)} for more info on this.
|
* See {@link org.bitcoinj.wallet.DeterministicKeyChain#markKeyAsUsed(DeterministicKey)} for more info on this.
|
||||||
*/
|
*/
|
||||||
private void markKeysAsUsed(Transaction tx) {
|
private void markKeysAsUsed(Transaction tx) {
|
||||||
lock.lock();
|
lock.lock();
|
||||||
@ -917,7 +916,7 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the immutable seed for the current active HD chain.
|
* Returns the immutable seed for the current active HD chain.
|
||||||
* @throws com.google.bitcoin.core.ECKey.MissingPrivateKeyException if the seed is unavailable (watching wallet)
|
* @throws org.bitcoinj.core.ECKey.MissingPrivateKeyException if the seed is unavailable (watching wallet)
|
||||||
*/
|
*/
|
||||||
public DeterministicSeed getKeyChainSeed() {
|
public DeterministicSeed getKeyChainSeed() {
|
||||||
lock.lock();
|
lock.lock();
|
||||||
@ -946,7 +945,7 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience wrapper around {@link Wallet#encrypt(com.google.bitcoin.crypto.KeyCrypter,
|
* Convenience wrapper around {@link Wallet#encrypt(org.bitcoinj.crypto.KeyCrypter,
|
||||||
* org.spongycastle.crypto.params.KeyParameter)} which uses the default Scrypt key derivation algorithm and
|
* org.spongycastle.crypto.params.KeyParameter)} which uses the default Scrypt key derivation algorithm and
|
||||||
* parameters to derive a key from the given password.
|
* parameters to derive a key from the given password.
|
||||||
*/
|
*/
|
||||||
@ -963,7 +962,7 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Encrypt the wallet using the KeyCrypter and the AES key. A good default KeyCrypter to use is
|
* Encrypt the wallet using the KeyCrypter and the AES key. A good default KeyCrypter to use is
|
||||||
* {@link com.google.bitcoin.crypto.KeyCrypterScrypt}.
|
* {@link org.bitcoinj.crypto.KeyCrypterScrypt}.
|
||||||
*
|
*
|
||||||
* @param keyCrypter The KeyCrypter that specifies how to encrypt/ decrypt a key
|
* @param keyCrypter The KeyCrypter that specifies how to encrypt/ decrypt a key
|
||||||
* @param aesKey AES key to use (normally created using KeyCrypter#deriveKey and cached as it is time consuming to create from a password)
|
* @param aesKey AES key to use (normally created using KeyCrypter#deriveKey and cached as it is time consuming to create from a password)
|
||||||
@ -1241,7 +1240,7 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
|
|||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* Disables auto-saving, after it had been enabled with
|
* Disables auto-saving, after it had been enabled with
|
||||||
* {@link Wallet#autosaveToFile(java.io.File, long, java.util.concurrent.TimeUnit, com.google.bitcoin.wallet.WalletFiles.Listener)}
|
* {@link Wallet#autosaveToFile(java.io.File, long, java.util.concurrent.TimeUnit, org.bitcoinj.wallet.WalletFiles.Listener)}
|
||||||
* before. This method blocks until finished.
|
* before. This method blocks until finished.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
@ -2624,7 +2623,7 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the earliest creation time of keys or watched scripts in this wallet, in seconds since the epoch, ie the min
|
* Returns the earliest creation time of keys or watched scripts in this wallet, in seconds since the epoch, ie the min
|
||||||
* of {@link com.google.bitcoin.core.ECKey#getCreationTimeSeconds()}. This can return zero if at least one key does
|
* of {@link org.bitcoinj.core.ECKey#getCreationTimeSeconds()}. This can return zero if at least one key does
|
||||||
* not have that data (was created before key timestamping was implemented). <p>
|
* not have that data (was created before key timestamping was implemented). <p>
|
||||||
*
|
*
|
||||||
* This method is most often used in conjunction with {@link PeerGroup#setFastCatchupTimeSecs(long)} in order to
|
* This method is most often used in conjunction with {@link PeerGroup#setFastCatchupTimeSecs(long)} in order to
|
||||||
@ -2877,7 +2876,7 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
|
|||||||
* money to fail! Finally please be aware that any listeners on the future will run either on the calling thread
|
* money to fail! Finally please be aware that any listeners on the future will run either on the calling thread
|
||||||
* if it completes immediately, or eventually on a background thread if the balance is not yet at the right
|
* if it completes immediately, or eventually on a background thread if the balance is not yet at the right
|
||||||
* level. If you do something that means you know the balance should be sufficient to trigger the future,
|
* level. If you do something that means you know the balance should be sufficient to trigger the future,
|
||||||
* you can use {@link com.google.bitcoin.utils.Threading#waitForUserCode()} to block until the future had a
|
* you can use {@link org.bitcoinj.utils.Threading#waitForUserCode()} to block until the future had a
|
||||||
* chance to be updated.</p>
|
* chance to be updated.</p>
|
||||||
*/
|
*/
|
||||||
public ListenableFuture<Coin> getBalanceFuture(final Coin value, final BalanceType type) {
|
public ListenableFuture<Coin> getBalanceFuture(final Coin value, final BalanceType type) {
|
||||||
@ -2959,7 +2958,7 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
|
|||||||
*/
|
*/
|
||||||
USE_DUMMY_SIG,
|
USE_DUMMY_SIG,
|
||||||
/**
|
/**
|
||||||
* If signature is missing, {@link com.google.bitcoin.signers.TransactionSigner.MissingSignatureException}
|
* If signature is missing, {@link org.bitcoinj.signers.TransactionSigner.MissingSignatureException}
|
||||||
* will be thrown for P2SH and {@link ECKey.MissingPrivateKeyException} for other tx types.
|
* will be thrown for P2SH and {@link ECKey.MissingPrivateKeyException} for other tx types.
|
||||||
*/
|
*/
|
||||||
THROW
|
THROW
|
||||||
@ -2990,7 +2989,7 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* When emptyWallet is set, all coins selected by the coin selector are sent to the first output in tx
|
* When emptyWallet is set, all coins selected by the coin selector are sent to the first output in tx
|
||||||
* (its value is ignored and set to {@link com.google.bitcoin.core.Wallet#getBalance()} - the fees required
|
* (its value is ignored and set to {@link org.bitcoinj.core.Wallet#getBalance()} - the fees required
|
||||||
* for the transaction). Any additional outputs are removed.
|
* for the transaction). Any additional outputs are removed.
|
||||||
*/
|
*/
|
||||||
public boolean emptyWallet = false;
|
public boolean emptyWallet = false;
|
||||||
@ -3064,7 +3063,7 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
|
|||||||
public KeyParameter aesKey = null;
|
public KeyParameter aesKey = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If not null, the {@link com.google.bitcoin.wallet.CoinSelector} to use instead of the wallets default. Coin selectors are
|
* If not null, the {@link org.bitcoinj.wallet.CoinSelector} to use instead of the wallets default. Coin selectors are
|
||||||
* responsible for choosing which transaction outputs (coins) in a wallet to use given the desired send value
|
* responsible for choosing which transaction outputs (coins) in a wallet to use given the desired send value
|
||||||
* amount.
|
* amount.
|
||||||
*/
|
*/
|
||||||
@ -4256,7 +4255,7 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
|
|||||||
* re-organisation of the wallet contents on the block chain. For instance, in future the wallet may choose to
|
* re-organisation of the wallet contents on the block chain. For instance, in future the wallet may choose to
|
||||||
* optimise itself to reduce fees or improve privacy.</p>
|
* optimise itself to reduce fees or improve privacy.</p>
|
||||||
*/
|
*/
|
||||||
public void setTransactionBroadcaster(@Nullable com.google.bitcoin.core.TransactionBroadcaster broadcaster) {
|
public void setTransactionBroadcaster(@Nullable org.bitcoinj.core.TransactionBroadcaster broadcaster) {
|
||||||
Transaction[] toBroadcast = {};
|
Transaction[] toBroadcast = {};
|
||||||
lock.lock();
|
lock.lock();
|
||||||
try {
|
try {
|
||||||
@ -4462,7 +4461,7 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the wallet lock under which most operations happen. This is here to satisfy the
|
* Returns the wallet lock under which most operations happen. This is here to satisfy the
|
||||||
* {@link com.google.bitcoin.core.PeerFilterProvider} interface and generally should not be used directly by apps.
|
* {@link org.bitcoinj.core.PeerFilterProvider} interface and generally should not be used directly by apps.
|
||||||
* In particular, do <b>not</b> hold this lock if you're display a send confirm screen to the user or for any other
|
* In particular, do <b>not</b> hold this lock if you're display a send confirm screen to the user or for any other
|
||||||
* long length of time, as it may cause processing holdups elsewhere. Instead, for the "confirm payment screen"
|
* long length of time, as it may cause processing holdups elsewhere. Instead, for the "confirm payment screen"
|
||||||
* use case you should complete a candidate transaction, present it to the user (e.g. for fee purposes) and then
|
* use case you should complete a candidate transaction, present it to the user (e.g. for fee purposes) and then
|
@ -14,10 +14,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import com.google.bitcoin.script.Script;
|
import org.bitcoinj.script.Script;
|
||||||
import com.google.bitcoin.wallet.KeyChainEventListener;
|
import org.bitcoinj.wallet.KeyChainEventListener;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ public interface WalletEventListener extends KeyChainEventListener {
|
|||||||
* was broadcast across the network or because a block was received. If a transaction is seen when it was broadcast,
|
* was broadcast across the network or because a block was received. If a transaction is seen when it was broadcast,
|
||||||
* onCoinsReceived won't be called again when a block containing it is received. If you want to know when such a
|
* onCoinsReceived won't be called again when a block containing it is received. If you want to know when such a
|
||||||
* transaction receives its first confirmation, register a {@link TransactionConfidence} event listener using
|
* transaction receives its first confirmation, register a {@link TransactionConfidence} event listener using
|
||||||
* the object retrieved via {@link com.google.bitcoin.core.Transaction#getConfidence()}. It's safe to modify the
|
* the object retrieved via {@link org.bitcoinj.core.Transaction#getConfidence()}. It's safe to modify the
|
||||||
* wallet in this callback, for example, by spending the transaction just received.
|
* wallet in this callback, for example, by spending the transaction just received.
|
||||||
*
|
*
|
||||||
* @param wallet The wallet object that received the coins
|
* @param wallet The wallet object that received the coins
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>An object implementing this interface can be added to a {@link Wallet} and provide arbitrary byte arrays that will
|
* <p>An object implementing this interface can be added to a {@link Wallet} and provide arbitrary byte arrays that will
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.core;
|
package org.bitcoinj.core;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
@ -14,9 +14,9 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.crypto;
|
package org.bitcoinj.crypto;
|
||||||
|
|
||||||
import com.google.bitcoin.core.*;
|
import org.bitcoinj.core.*;
|
||||||
import com.google.common.base.Charsets;
|
import com.google.common.base.Charsets;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.primitives.Bytes;
|
import com.google.common.primitives.Bytes;
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.crypto;
|
package org.bitcoinj.crypto;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>This is just a wrapper for the i (child number) as per BIP 32 with a boolean getter for the most significant bit
|
* <p>This is just a wrapper for the i (child number) as per BIP 32 with a boolean getter for the most significant bit
|
@ -1,6 +1,6 @@
|
|||||||
package com.google.bitcoin.crypto;
|
package org.bitcoinj.crypto;
|
||||||
|
|
||||||
import com.google.bitcoin.core.Utils;
|
import org.bitcoinj.core.Utils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.crypto;
|
package org.bitcoinj.crypto;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
@ -14,9 +14,9 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package com.google.bitcoin.crypto;
|
package org.bitcoinj.crypto;
|
||||||
|
|
||||||
import com.google.bitcoin.core.*;
|
import org.bitcoinj.core.*;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.base.Objects.ToStringHelper;
|
import com.google.common.base.Objects.ToStringHelper;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
@ -28,7 +28,7 @@ import java.math.BigInteger;
|
|||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import static com.google.bitcoin.core.Utils.HEX;
|
import static org.bitcoinj.core.Utils.HEX;
|
||||||
import static com.google.common.base.Preconditions.*;
|
import static com.google.common.base.Preconditions.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -204,7 +204,7 @@ public class DeterministicKey extends ECKey {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns this keys {@link com.google.bitcoin.crypto.KeyCrypter} <b>or</b> the keycrypter of its parent key.
|
* Returns this keys {@link org.bitcoinj.crypto.KeyCrypter} <b>or</b> the keycrypter of its parent key.
|
||||||
*/
|
*/
|
||||||
@Override @Nullable
|
@Override @Nullable
|
||||||
public KeyCrypter getKeyCrypter() {
|
public KeyCrypter getKeyCrypter() {
|
||||||
@ -408,7 +408,7 @@ public class DeterministicKey extends ECKey {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The creation time of a deterministic key is equal to that of its parent, unless this key is the root of a tree
|
* The creation time of a deterministic key is equal to that of its parent, unless this key is the root of a tree
|
||||||
* in which case the time is stored alongside the key as per normal, see {@link com.google.bitcoin.core.ECKey#getCreationTimeSeconds()}.
|
* in which case the time is stored alongside the key as per normal, see {@link org.bitcoinj.core.ECKey#getCreationTimeSeconds()}.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public long getCreationTimeSeconds() {
|
public long getCreationTimeSeconds() {
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.crypto;
|
package org.bitcoinj.crypto;
|
||||||
|
|
||||||
import org.bitcoinj.wallet.Protos;
|
import org.bitcoinj.wallet.Protos;
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ import javax.annotation.Nullable;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a uniform way to access something that can be optionally encrypted with a
|
* Provides a uniform way to access something that can be optionally encrypted with a
|
||||||
* {@link com.google.bitcoin.crypto.KeyCrypter}, yielding an {@link com.google.bitcoin.crypto.EncryptedData}, and
|
* {@link org.bitcoinj.crypto.KeyCrypter}, yielding an {@link org.bitcoinj.crypto.EncryptedData}, and
|
||||||
* which can have a creation time associated with it.
|
* which can have a creation time associated with it.
|
||||||
*/
|
*/
|
||||||
public interface EncryptableItem {
|
public interface EncryptableItem {
|
@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package com.google.bitcoin.crypto;
|
package org.bitcoinj.crypto;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package com.google.bitcoin.crypto;
|
package org.bitcoinj.crypto;
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.crypto;
|
package org.bitcoinj.crypto;
|
||||||
|
|
||||||
public class HDDerivationException extends RuntimeException {
|
public class HDDerivationException extends RuntimeException {
|
||||||
public HDDerivationException(String message) {
|
public HDDerivationException(String message) {
|
@ -14,10 +14,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.crypto;
|
package org.bitcoinj.crypto;
|
||||||
|
|
||||||
import com.google.bitcoin.core.ECKey;
|
import org.bitcoinj.core.ECKey;
|
||||||
import com.google.bitcoin.core.Utils;
|
import org.bitcoinj.core.Utils;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import org.spongycastle.crypto.macs.HMac;
|
import org.spongycastle.crypto.macs.HMac;
|
||||||
import org.spongycastle.math.ec.ECPoint;
|
import org.spongycastle.math.ec.ECPoint;
|
@ -15,9 +15,9 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.crypto;
|
package org.bitcoinj.crypto;
|
||||||
|
|
||||||
import com.google.bitcoin.core.ECKey;
|
import org.bitcoinj.core.ECKey;
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package com.google.bitcoin.crypto;
|
package org.bitcoinj.crypto;
|
||||||
|
|
||||||
import org.bitcoinj.wallet.Protos.Wallet.EncryptionType;
|
import org.bitcoinj.wallet.Protos.Wallet.EncryptionType;
|
||||||
import org.spongycastle.crypto.params.KeyParameter;
|
import org.spongycastle.crypto.params.KeyParameter;
|
@ -1,4 +1,4 @@
|
|||||||
package com.google.bitcoin.crypto;
|
package org.bitcoinj.crypto;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Exception to provide the following to {@link EncrypterDecrypterOpenSSL}:</p>
|
* <p>Exception to provide the following to {@link EncrypterDecrypterOpenSSL}:</p>
|
@ -14,7 +14,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package com.google.bitcoin.crypto;
|
package org.bitcoinj.crypto;
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.protobuf.ByteString;
|
import com.google.protobuf.ByteString;
|
@ -15,10 +15,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.crypto;
|
package org.bitcoinj.crypto;
|
||||||
|
|
||||||
import com.google.bitcoin.core.Sha256Hash;
|
import org.bitcoinj.core.Sha256Hash;
|
||||||
import com.google.bitcoin.core.Utils;
|
import org.bitcoinj.core.Utils;
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -34,7 +34,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.google.bitcoin.core.Utils.HEX;
|
import static org.bitcoinj.core.Utils.HEX;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A MnemonicCode object may be used to convert between binary seed values and
|
* A MnemonicCode object may be used to convert between binary seed values and
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.crypto;
|
package org.bitcoinj.crypto;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exceptions thrown by the MnemonicCode module.
|
* Exceptions thrown by the MnemonicCode module.
|
@ -21,7 +21,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.crypto;
|
package org.bitcoinj.crypto;
|
||||||
|
|
||||||
import javax.crypto.Mac;
|
import javax.crypto.Mac;
|
||||||
import javax.crypto.spec.SecretKeySpec;
|
import javax.crypto.spec.SecretKeySpec;
|
@ -14,18 +14,18 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.bitcoin.crypto;
|
package org.bitcoinj.crypto;
|
||||||
|
|
||||||
import com.google.bitcoin.core.ECKey;
|
import org.bitcoinj.core.ECKey;
|
||||||
import com.google.bitcoin.core.Transaction;
|
import org.bitcoinj.core.Transaction;
|
||||||
import com.google.bitcoin.core.VerificationException;
|
import org.bitcoinj.core.VerificationException;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A TransactionSignature wraps an {@link com.google.bitcoin.core.ECKey.ECDSASignature} and adds methods for handling
|
* A TransactionSignature wraps an {@link org.bitcoinj.core.ECKey.ECDSASignature} and adds methods for handling
|
||||||
* the additional SIGHASH mode byte that is used.
|
* the additional SIGHASH mode byte that is used.
|
||||||
*/
|
*/
|
||||||
public class TransactionSignature extends ECKey.ECDSASignature {
|
public class TransactionSignature extends ECKey.ECDSASignature {
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user