mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-11-01 21:17:13 +00:00
Remove IOException from TestWithWallet.
This commit is contained in:
@@ -23,7 +23,6 @@ import org.bitcoinj.store.MemoryBlockStore;
|
|||||||
import org.bitcoinj.utils.BriefLogFormatter;
|
import org.bitcoinj.utils.BriefLogFormatter;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import static org.bitcoinj.testing.FakeTxBuilder.createFakeBlock;
|
import static org.bitcoinj.testing.FakeTxBuilder.createFakeBlock;
|
||||||
import static org.bitcoinj.testing.FakeTxBuilder.createFakeTx;
|
import static org.bitcoinj.testing.FakeTxBuilder.createFakeTx;
|
||||||
@@ -62,7 +61,7 @@ public class TestWithWallet {
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
protected Transaction sendMoneyToWallet(Wallet wallet, Transaction tx, AbstractBlockChain.NewBlockType type)
|
protected Transaction sendMoneyToWallet(Wallet wallet, Transaction tx, AbstractBlockChain.NewBlockType type)
|
||||||
throws IOException, VerificationException {
|
throws VerificationException {
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
// Pending/broadcast tx.
|
// Pending/broadcast tx.
|
||||||
if (wallet.isPendingTransactionRelevant(tx))
|
if (wallet.isPendingTransactionRelevant(tx))
|
||||||
@@ -77,22 +76,22 @@ public class TestWithWallet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
protected Transaction sendMoneyToWallet(Transaction tx, AbstractBlockChain.NewBlockType type) throws IOException, VerificationException {
|
protected Transaction sendMoneyToWallet(Transaction tx, AbstractBlockChain.NewBlockType type) throws VerificationException {
|
||||||
return sendMoneyToWallet(this.wallet, tx, type);
|
return sendMoneyToWallet(this.wallet, tx, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
protected Transaction sendMoneyToWallet(Wallet wallet, Coin value, Address toAddress, AbstractBlockChain.NewBlockType type) throws IOException, VerificationException {
|
protected Transaction sendMoneyToWallet(Wallet wallet, Coin value, Address toAddress, AbstractBlockChain.NewBlockType type) throws VerificationException {
|
||||||
return sendMoneyToWallet(wallet, createFakeTx(params, value, toAddress), type);
|
return sendMoneyToWallet(wallet, createFakeTx(params, value, toAddress), type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
protected Transaction sendMoneyToWallet(Wallet wallet, Coin value, ECKey toPubKey, AbstractBlockChain.NewBlockType type) throws IOException, VerificationException {
|
protected Transaction sendMoneyToWallet(Wallet wallet, Coin value, ECKey toPubKey, AbstractBlockChain.NewBlockType type) throws VerificationException {
|
||||||
return sendMoneyToWallet(wallet, createFakeTx(params, value, toPubKey), type);
|
return sendMoneyToWallet(wallet, createFakeTx(params, value, toPubKey), type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
protected Transaction sendMoneyToWallet(Coin value, AbstractBlockChain.NewBlockType type) throws IOException, VerificationException {
|
protected Transaction sendMoneyToWallet(Coin value, AbstractBlockChain.NewBlockType type) throws VerificationException {
|
||||||
return sendMoneyToWallet(this.wallet, createFakeTx(params, value, myAddress), type);
|
return sendMoneyToWallet(this.wallet, createFakeTx(params, value, myAddress), type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ import org.slf4j.LoggerFactory;
|
|||||||
import org.spongycastle.crypto.params.KeyParameter;
|
import org.spongycastle.crypto.params.KeyParameter;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
@@ -368,7 +367,7 @@ public class WalletTest extends TestWithWallet {
|
|||||||
receiveATransactionAmount(wallet, toAddress, COIN);
|
receiveATransactionAmount(wallet, toAddress, COIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void receiveATransactionAmount(Wallet wallet, Address toAddress, Coin amount) throws IOException {
|
private void receiveATransactionAmount(Wallet wallet, Address toAddress, Coin amount) {
|
||||||
final ListenableFuture<Coin> availFuture = wallet.getBalanceFuture(amount, Wallet.BalanceType.AVAILABLE);
|
final ListenableFuture<Coin> availFuture = wallet.getBalanceFuture(amount, Wallet.BalanceType.AVAILABLE);
|
||||||
final ListenableFuture<Coin> estimatedFuture = wallet.getBalanceFuture(amount, Wallet.BalanceType.ESTIMATED);
|
final ListenableFuture<Coin> estimatedFuture = wallet.getBalanceFuture(amount, Wallet.BalanceType.ESTIMATED);
|
||||||
assertFalse(availFuture.isDone());
|
assertFalse(availFuture.isDone());
|
||||||
@@ -1598,7 +1597,7 @@ public class WalletTest extends TestWithWallet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void importAndEncrypt() throws IOException, InsufficientMoneyException {
|
public void importAndEncrypt() throws InsufficientMoneyException {
|
||||||
final ECKey key = new ECKey();
|
final ECKey key = new ECKey();
|
||||||
encryptedWallet.importKeysAndEncrypt(ImmutableList.of(key), PASSWORD1);
|
encryptedWallet.importKeysAndEncrypt(ImmutableList.of(key), PASSWORD1);
|
||||||
assertEquals(1, encryptedWallet.getImportedKeys().size());
|
assertEquals(1, encryptedWallet.getImportedKeys().size());
|
||||||
@@ -2988,7 +2987,7 @@ public class WalletTest extends TestWithWallet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void sendCoinsWithBroadcasterTest() throws InsufficientMoneyException, IOException {
|
public void sendCoinsWithBroadcasterTest() throws InsufficientMoneyException {
|
||||||
ECKey key = ECKey.fromPrivate(BigInteger.ONE);
|
ECKey key = ECKey.fromPrivate(BigInteger.ONE);
|
||||||
Address notMyAddr = key.toAddress(params);
|
Address notMyAddr = key.toAddress(params);
|
||||||
receiveATransactionAmount(wallet, myAddress, Coin.COIN);
|
receiveATransactionAmount(wallet, myAddress, Coin.COIN);
|
||||||
|
|||||||
Reference in New Issue
Block a user