Skip to content

Commit

Permalink
Merge pull request #7323 from alvasw/BitcoinjBsqTests_Create_per_test…
Browse files Browse the repository at this point in the history
…_BSQ_wallet

BitcoinjBsqTests: Create per test BSQ wallet
  • Loading branch information
alejandrogarcia83 authored Dec 10, 2024
2 parents e4b618d + f098ece commit 8ae9a39
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions core/src/integrationTest/java/bisq/core/BitcoinjBsqTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,9 @@ public class BitcoinjBsqTests {
private final BisqRegtestNetworkParams networkParams;
private PeerGroup peerGroup;

private RegtestWalletAppKit regtestWalletAppKit;
private final Wallet btcWallet;
private Wallet bsqWallet;
private final Wallet secondBsqWallet;
private final Wallet emptyBsqWallet;

private final BisqDefaultCoinSelector btcCoinSelector = new BisqDefaultCoinSelector(true) {
@Override
Expand All @@ -84,14 +83,11 @@ public BitcoinjBsqTests(BitcoindRegtestSetup bitcoindRegtestSetup) {

var walletFactory = new WalletFactory(networkParams);
btcWallet = walletFactory.createBtcWallet();
secondBsqWallet = walletFactory.createBsqWallet();
emptyBsqWallet = walletFactory.createBsqWallet();
}

@BeforeAll
void setup(@TempDir Path tempDir) throws InterruptedException {
var wallets = List.of(btcWallet, secondBsqWallet);
var regtestWalletAppKit = new RegtestWalletAppKit(networkParams, tempDir, wallets);
regtestWalletAppKit = new RegtestWalletAppKit(networkParams, tempDir, List.of(btcWallet));
regtestWalletAppKit.initialize();

WalletAppKit walletAppKit = regtestWalletAppKit.getWalletAppKit();
Expand All @@ -117,6 +113,7 @@ void sendBsqTest() throws InterruptedException, InsufficientMoneyException, BsqC
bsqWallet,
bsqCoinSelector);

Wallet secondBsqWallet = regtestWalletAppKit.createNewBsqWallet();
var secondBsqWalletReceivedLatch = new CountDownLatch(1);
secondBsqWallet.addCoinsReceivedEventListener((wallet, tx, prevBalance, newBalance) ->
secondBsqWalletReceivedLatch.countDown());
Expand All @@ -138,6 +135,7 @@ void sendBsqTest() throws InterruptedException, InsufficientMoneyException, BsqC

@Test
void sendBsqButNotEnoughBsqTest() {
Wallet emptyBsqWallet = regtestWalletAppKit.createNewBsqWallet();
var bsqWalletV2 = new BsqWalletV2(networkParams,
peerGroup,
btcWalletV2,
Expand All @@ -164,6 +162,7 @@ void sendMoreBsqThanInWalletTest() {
bsqWallet,
bsqCoinSelector);

Wallet secondBsqWallet = regtestWalletAppKit.createNewBsqWallet();
var secondBsqWalletReceivedLatch = new CountDownLatch(1);
secondBsqWallet.addCoinsReceivedEventListener((wallet, tx, prevBalance, newBalance) ->
secondBsqWalletReceivedLatch.countDown());
Expand Down

0 comments on commit 8ae9a39

Please sign in to comment.