use of co.rsk.bitcoinj.core.UTXOProvider in project rskj by rsksmart.
the class BridgeUtilsTest method test_getSpendWallet.
private void test_getSpendWallet(boolean isFastBridgeCompatible) throws UTXOProviderException {
Federation federation = new Federation(FederationTestUtils.getFederationMembersWithBtcKeys(Arrays.asList(BtcECKey.fromPublicOnly(Hex.decode("036bb9eab797eadc8b697f0e82a01d01cabbfaaca37e5bafc06fdc6fdd38af894a")), BtcECKey.fromPublicOnly(Hex.decode("031da807c71c2f303b7f409dd2605b297ac494a563be3b9ca5f52d95a43d183cc5")))), Instant.ofEpochMilli(5005L), 0L, networkParameters);
Context mockedBtcContext = mock(Context.class);
when(mockedBtcContext.getParams()).thenReturn(networkParameters);
List<UTXO> mockedUtxos = new ArrayList<>();
mockedUtxos.add(mock(UTXO.class));
mockedUtxos.add(mock(UTXO.class));
mockedUtxos.add(mock(UTXO.class));
Wallet wallet = BridgeUtils.getFederationSpendWallet(mockedBtcContext, federation, mockedUtxos, isFastBridgeCompatible, null);
if (isFastBridgeCompatible) {
Assert.assertEquals(FastBridgeCompatibleBtcWalletWithStorage.class, wallet.getClass());
} else {
Assert.assertEquals(BridgeBtcWallet.class, wallet.getClass());
}
assertIsWatching(federation.getAddress(), wallet, networkParameters);
CoinSelector selector = wallet.getCoinSelector();
Assert.assertEquals(RskAllowUnconfirmedCoinSelector.class, selector.getClass());
UTXOProvider utxoProvider = wallet.getUTXOProvider();
Assert.assertEquals(RskUTXOProvider.class, utxoProvider.getClass());
Assert.assertEquals(mockedUtxos, utxoProvider.getOpenTransactionOutputs(Collections.emptyList()));
}
Aggregations