Skip to content

Commit

Permalink
Upgrade to BitcoinJ 0.12-SNAPSHOT
Browse files Browse the repository at this point in the history
 - Update imports to reflect BitcoinJ's repackaging, including:

   git grep -l 'import com.google.bitcoin' | \
   xargs perl -p -i -e 's/import com.google.bitcoin/import org.bitcoinj/'

   git grep -l 'com.google.bitcoin' | \
   xargs perl -p -i -e 's/com.google.bitcoin/org.bitcoinj/'

 - Replace use of BitcoinJ's CoinFormat, which has now been renamed to
   MonetaryFormat, using:

   git grep -l 'CoinFormat' | \
   xargs perl -p -i -e 's/CoinFormat/MonetaryFormat/g'

 - Fix calls to BitcoinJ's Script#correctlySpends, whose signature has
   changed from 0.11 => 0.12.

See #98
  • Loading branch information
cbeams committed Oct 2, 2014
1 parent d20a930 commit 041d8ec
Show file tree
Hide file tree
Showing 76 changed files with 227 additions and 226 deletions.
2 changes: 1 addition & 1 deletion .idea/codeStyleSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ task executableJar(type: OneJar) {

repositories {
jcenter()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
maven { url 'http://partnerdemo.artifactoryonline.com/partnerdemo/libs-snapshots-local' }
}

dependencies {
compile 'com.google:bitcoinj:0.12.308de4e-SNAPSHOT'
compile 'org.bitcoinj:bitcoinj-core:0.12-SNAPSHOT'
compile 'net.tomp2p:tomp2p-all:5.0-Alpha24.805623c-SNAPSHOT'
compile 'org.slf4j:slf4j-api:1.7.7'
compile 'ch.qos.logback:logback-core:1.1.2'
Expand Down
20 changes: 10 additions & 10 deletions src/main/java/io/bitsquare/btc/AddressBasedCoinSelector.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@

package io.bitsquare.btc;

import com.google.bitcoin.core.Address;
import com.google.bitcoin.core.Coin;
import com.google.bitcoin.core.NetworkParameters;
import com.google.bitcoin.core.Transaction;
import com.google.bitcoin.core.TransactionConfidence;
import com.google.bitcoin.core.TransactionOutput;
import com.google.bitcoin.params.RegTestParams;
import com.google.bitcoin.wallet.CoinSelection;
import com.google.bitcoin.wallet.DefaultCoinSelector;
import org.bitcoinj.core.Address;
import org.bitcoinj.core.Coin;
import org.bitcoinj.core.NetworkParameters;
import org.bitcoinj.core.Transaction;
import org.bitcoinj.core.TransactionConfidence;
import org.bitcoinj.core.TransactionOutput;
import org.bitcoinj.params.RegTestParams;
import org.bitcoinj.wallet.CoinSelection;
import org.bitcoinj.wallet.DefaultCoinSelector;

import com.google.common.annotations.VisibleForTesting;

Expand All @@ -40,7 +40,7 @@
import org.slf4j.LoggerFactory;

/**
* This class implements a {@link com.google.bitcoin.wallet.CoinSelector} which attempts to get the highest priority
* This class implements a {@link org.bitcoinj.wallet.CoinSelector} which attempts to get the highest priority
* possible. This means that the transaction is the most likely to get confirmed. Note that this means we may end up
* "spending" more priority than would be required to get the transaction we are creating confirmed.
*/
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/io/bitsquare/btc/AddressEntry.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

package io.bitsquare.btc;

import com.google.bitcoin.core.Address;
import com.google.bitcoin.core.NetworkParameters;
import com.google.bitcoin.core.Utils;
import com.google.bitcoin.crypto.DeterministicKey;
import org.bitcoinj.core.Address;
import org.bitcoinj.core.NetworkParameters;
import org.bitcoinj.core.Utils;
import org.bitcoinj.crypto.DeterministicKey;

import java.io.Serializable;

Expand Down
10 changes: 5 additions & 5 deletions src/main/java/io/bitsquare/btc/FeePolicy.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@

package io.bitsquare.btc;

import com.google.bitcoin.core.Address;
import com.google.bitcoin.core.AddressFormatException;
import com.google.bitcoin.core.Coin;
import com.google.bitcoin.core.NetworkParameters;
import com.google.bitcoin.core.Transaction;
import org.bitcoinj.core.Address;
import org.bitcoinj.core.AddressFormatException;
import org.bitcoinj.core.Coin;
import org.bitcoinj.core.NetworkParameters;
import org.bitcoinj.core.Transaction;

import javax.inject.Inject;

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/bitsquare/btc/Restrictions.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

package io.bitsquare.btc;

import com.google.bitcoin.core.Coin;
import com.google.bitcoin.core.Transaction;
import org.bitcoinj.core.Coin;
import org.bitcoinj.core.Transaction;

// Lets see if we get more restriction otherwise move it to other class
public class Restrictions {
Expand Down
62 changes: 31 additions & 31 deletions src/main/java/io/bitsquare/btc/WalletFacade.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,31 @@
import io.bitsquare.crypto.CryptoFacade;
import io.bitsquare.persistence.Persistence;

import com.google.bitcoin.core.Address;
import com.google.bitcoin.core.AddressFormatException;
import com.google.bitcoin.core.Coin;
import com.google.bitcoin.core.ECKey;
import com.google.bitcoin.core.InsufficientMoneyException;
import com.google.bitcoin.core.NetworkParameters;
import com.google.bitcoin.core.ScriptException;
import com.google.bitcoin.core.Sha256Hash;
import com.google.bitcoin.core.Transaction;
import com.google.bitcoin.core.TransactionConfidence;
import com.google.bitcoin.core.TransactionInput;
import com.google.bitcoin.core.TransactionOutPoint;
import com.google.bitcoin.core.TransactionOutput;
import com.google.bitcoin.core.Utils;
import com.google.bitcoin.core.VerificationException;
import com.google.bitcoin.core.Wallet;
import com.google.bitcoin.core.WalletEventListener;
import com.google.bitcoin.crypto.DeterministicKey;
import com.google.bitcoin.crypto.TransactionSignature;
import com.google.bitcoin.kits.WalletAppKit;
import com.google.bitcoin.params.MainNetParams;
import com.google.bitcoin.params.RegTestParams;
import com.google.bitcoin.script.Script;
import com.google.bitcoin.script.ScriptBuilder;
import com.google.bitcoin.utils.Threading;
import org.bitcoinj.core.Address;
import org.bitcoinj.core.AddressFormatException;
import org.bitcoinj.core.Coin;
import org.bitcoinj.core.ECKey;
import org.bitcoinj.core.InsufficientMoneyException;
import org.bitcoinj.core.NetworkParameters;
import org.bitcoinj.core.ScriptException;
import org.bitcoinj.core.Sha256Hash;
import org.bitcoinj.core.Transaction;
import org.bitcoinj.core.TransactionConfidence;
import org.bitcoinj.core.TransactionInput;
import org.bitcoinj.core.TransactionOutPoint;
import org.bitcoinj.core.TransactionOutput;
import org.bitcoinj.core.Utils;
import org.bitcoinj.core.VerificationException;
import org.bitcoinj.core.Wallet;
import org.bitcoinj.core.WalletEventListener;
import org.bitcoinj.crypto.DeterministicKey;
import org.bitcoinj.crypto.TransactionSignature;
import org.bitcoinj.kits.WalletAppKit;
import org.bitcoinj.params.MainNetParams;
import org.bitcoinj.params.RegTestParams;
import org.bitcoinj.script.Script;
import org.bitcoinj.script.ScriptBuilder;
import org.bitcoinj.utils.Threading;

import com.google.common.collect.ImmutableList;
import com.google.common.util.concurrent.FutureCallback;
Expand Down Expand Up @@ -81,7 +81,7 @@

import lighthouse.files.AppDirectory;

import static com.google.bitcoin.script.ScriptOpCodes.OP_RETURN;
import static org.bitcoinj.script.ScriptOpCodes.OP_RETURN;

/**
* TODO: use walletextension (with protobuffer) instead of saving addressEntryList via storage
Expand Down Expand Up @@ -802,7 +802,7 @@ else if (scriptPubKey.isSentToAddress()) {
}

log.trace("check if it can be correctly spent for input 1");
input.getScriptSig().correctlySpends(tx, 1, scriptPubKey, false);
input.getScriptSig().correctlySpends(tx, 1, scriptPubKey);

log.trace("verify tx");
tx.verify();
Expand Down Expand Up @@ -917,12 +917,12 @@ else if (scriptPubKey.isSentToAddress()) {
throw new ScriptException("Don't know how to sign for this kind of scriptPubKey: " + scriptPubKey);
}

input.getScriptSig().correctlySpends(tx, 0, scriptPubKey, false);
input.getScriptSig().correctlySpends(tx, 0, scriptPubKey);
log.trace("check if it can be correctly spent for input 0 OK");

TransactionInput input1 = tx.getInput(1);
scriptPubKey = input1.getConnectedOutput().getScriptPubKey();
input1.getScriptSig().correctlySpends(tx, 1, scriptPubKey, false);
input1.getScriptSig().correctlySpends(tx, 1, scriptPubKey);
log.trace("check if it can be correctly spent for input 1 OK");

/*
Expand Down Expand Up @@ -1053,7 +1053,7 @@ public void takerSignsAndSendsTx(String depositTxAsHex,
tx.verify();

log.trace("check if it can be correctly spent for ms input");
tx.getInput(0).getScriptSig().correctlySpends(tx, 0, multiSigScript, false);
tx.getInput(0).getScriptSig().correctlySpends(tx, 0, multiSigScript);

log.trace("verify multiSigOutput");
tx.getInput(0).verify(multiSigOutput);
Expand Down Expand Up @@ -1140,7 +1140,7 @@ public static interface DownloadListener {
void downloadComplete();
}

private class BlockChainDownloadListener extends com.google.bitcoin.core.DownloadListener {
private class BlockChainDownloadListener extends org.bitcoinj.core.DownloadListener {
@Override
protected void progress(double percent, int blocksSoFar, Date date) {
super.progress(percent, blocksSoFar, date);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

package io.bitsquare.btc.listeners;

import com.google.bitcoin.core.Address;
import com.google.bitcoin.core.TransactionConfidence;
import org.bitcoinj.core.Address;
import org.bitcoinj.core.TransactionConfidence;

public class AddressConfidenceListener {
private final Address address;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/bitsquare/btc/listeners/BalanceListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

package io.bitsquare.btc.listeners;

import com.google.bitcoin.core.Address;
import com.google.bitcoin.core.Coin;
import org.bitcoinj.core.Address;
import org.bitcoinj.core.Coin;

public class BalanceListener {
private Address address;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package io.bitsquare.btc.listeners;

import com.google.bitcoin.core.TransactionConfidence;
import org.bitcoinj.core.TransactionConfidence;

public class TxConfidenceListener {
private final String txID;
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/io/bitsquare/crypto/CryptoFacade.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

package io.bitsquare.crypto;

import com.google.bitcoin.core.ECKey;
import com.google.bitcoin.core.Sha256Hash;
import com.google.bitcoin.core.Utils;
import com.google.bitcoin.crypto.KeyCrypterException;
import org.bitcoinj.core.ECKey;
import org.bitcoinj.core.Sha256Hash;
import org.bitcoinj.core.Utils;
import org.bitcoinj.crypto.KeyCrypterException;

import com.google.common.base.Charsets;

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/io/bitsquare/di/BitSquareModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@
import io.bitsquare.user.User;
import io.bitsquare.util.ConfigLoader;

import com.google.bitcoin.core.NetworkParameters;
import com.google.bitcoin.params.MainNetParams;
import com.google.bitcoin.params.RegTestParams;
import com.google.bitcoin.params.TestNet3Params;
import org.bitcoinj.core.NetworkParameters;
import org.bitcoinj.params.MainNetParams;
import org.bitcoinj.params.RegTestParams;
import org.bitcoinj.params.TestNet3Params;

import com.google.inject.AbstractModule;
import com.google.inject.Provider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

import io.bitsquare.gui.OverlayManager;

import com.google.bitcoin.core.Coin;
import com.google.bitcoin.uri.BitcoinURI;
import org.bitcoinj.core.Coin;
import org.bitcoinj.uri.BitcoinURI;

import java.awt.*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
import io.bitsquare.gui.components.confidence.ConfidenceProgressIndicator;
import io.bitsquare.gui.util.BSFormatter;

import com.google.bitcoin.core.Address;
import com.google.bitcoin.core.Coin;
import com.google.bitcoin.core.TransactionConfidence;
import org.bitcoinj.core.Address;
import org.bitcoinj.core.Coin;
import org.bitcoinj.core.TransactionConfidence;

import javafx.scene.control.*;
import javafx.scene.effect.*;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/bitsquare/gui/components/Popups.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import io.bitsquare.gui.OverlayManager;
import io.bitsquare.locale.BSResources;

import com.google.bitcoin.store.BlockStoreException;
import org.bitcoinj.store.BlockStoreException;

import com.google.common.base.Throwables;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import io.bitsquare.btc.listeners.TxConfidenceListener;
import io.bitsquare.gui.components.confidence.ConfidenceProgressIndicator;

import com.google.bitcoin.core.TransactionConfidence;
import org.bitcoinj.core.TransactionConfidence;

import java.awt.*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
import io.bitsquare.user.User;
import io.bitsquare.util.DSAKeyUtil;

import com.google.bitcoin.core.Coin;
import com.google.bitcoin.core.ECKey;
import com.google.bitcoin.core.Transaction;
import com.google.bitcoin.core.Wallet;
import com.google.bitcoin.core.WalletEventListener;
import com.google.bitcoin.script.Script;
import org.bitcoinj.core.Coin;
import org.bitcoinj.core.ECKey;
import org.bitcoinj.core.Transaction;
import org.bitcoinj.core.Wallet;
import org.bitcoinj.core.WalletEventListener;
import org.bitcoinj.script.Script;

import java.net.URL;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
import io.bitsquare.persistence.Persistence;
import io.bitsquare.user.User;

import com.google.bitcoin.core.Coin;
import com.google.bitcoin.core.InsufficientMoneyException;
import com.google.bitcoin.core.Transaction;
import org.bitcoinj.core.Coin;
import org.bitcoinj.core.InsufficientMoneyException;
import org.bitcoinj.core.Transaction;

import com.google.common.util.concurrent.FutureCallback;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import io.bitsquare.gui.util.BSFormatter;
import io.bitsquare.locale.BSResources;

import com.google.bitcoin.core.Address;
import com.google.bitcoin.core.Coin;
import org.bitcoinj.core.Address;
import org.bitcoinj.core.Coin;

import com.google.inject.Inject;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
import io.bitsquare.user.User;
import io.bitsquare.util.DSAKeyUtil;

import com.google.bitcoin.core.ECKey;
import com.google.bitcoin.core.Utils;
import org.bitcoinj.core.ECKey;
import org.bitcoinj.core.Utils;

import com.google.inject.Inject;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
import io.bitsquare.gui.components.confidence.ConfidenceProgressIndicator;
import io.bitsquare.gui.util.BSFormatter;

import com.google.bitcoin.core.Address;
import com.google.bitcoin.core.Coin;
import com.google.bitcoin.core.Transaction;
import com.google.bitcoin.core.TransactionConfidence;
import com.google.bitcoin.core.TransactionOutput;
import org.bitcoinj.core.Address;
import org.bitcoinj.core.Coin;
import org.bitcoinj.core.Transaction;
import org.bitcoinj.core.TransactionConfidence;
import org.bitcoinj.core.TransactionOutput;

import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import io.bitsquare.gui.components.Popups;
import io.bitsquare.gui.util.BSFormatter;

import com.google.bitcoin.core.Transaction;
import org.bitcoinj.core.Transaction;

import java.net.URL;

Expand Down
Loading

0 comments on commit 041d8ec

Please sign in to comment.