org.bitcoinj.core.TransactionBroadcaster Java Examples

The following examples show how to use org.bitcoinj.core.TransactionBroadcaster. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PaymentChannelServerTest.java    From bcm-android with GNU General Public License v3.0 5 votes vote down vote up
@Before
public void setUp() {
    broadcaster = createMock(TransactionBroadcaster.class);
    wallet = createMock(Wallet.class);
    connection = createMock(PaymentChannelServer.ServerConnection.class);
    serverVersionCapture = new Capture<TwoWayChannelMessage>();
    connection.sendToClient(capture(serverVersionCapture));
    Utils.setMockClock();
}
 
Example #2
Source File: ChannelTestUtils.java    From bcm-android with GNU General Public License v3.0 5 votes vote down vote up
public static RecordingPair makeRecorders(final Wallet serverWallet, final TransactionBroadcaster mockBroadcaster, int maxExpireTime) {
    RecordingPair pair = new RecordingPair();
    pair.serverRecorder = new RecordingServerConnection();
    pair.server = new PaymentChannelServer(mockBroadcaster, serverWallet, Coin.COIN, pair.serverRecorder);
    pair.clientRecorder = new RecordingClientConnection(maxExpireTime);
    return pair;
}
 
Example #3
Source File: PaymentChannelServerTest.java    From green_android with GNU General Public License v3.0 5 votes vote down vote up
@Before
public void setUp() {
    broadcaster = createMock(TransactionBroadcaster.class);
    wallet = createMock(Wallet.class);
    connection = createMock(PaymentChannelServer.ServerConnection.class);
    serverVersionCapture = new Capture<TwoWayChannelMessage>();
    connection.sendToClient(capture(serverVersionCapture));
    Utils.setMockClock();
}
 
Example #4
Source File: ChannelTestUtils.java    From green_android with GNU General Public License v3.0 5 votes vote down vote up
public static RecordingPair makeRecorders(final Wallet serverWallet, final TransactionBroadcaster mockBroadcaster, int maxExpireTime) {
    RecordingPair pair = new RecordingPair();
    pair.serverRecorder = new RecordingServerConnection();
    pair.server = new PaymentChannelServer(mockBroadcaster, serverWallet, Coin.COIN, pair.serverRecorder);
    pair.clientRecorder = new RecordingClientConnection(maxExpireTime);
    return pair;
}
 
Example #5
Source File: PaymentChannelServerTest.java    From GreenBits with GNU General Public License v3.0 5 votes vote down vote up
@Before
public void setUp() {
    broadcaster = createMock(TransactionBroadcaster.class);
    wallet = createMock(Wallet.class);
    connection = createMock(PaymentChannelServer.ServerConnection.class);
    serverVersionCapture = new Capture<TwoWayChannelMessage>();
    connection.sendToClient(capture(serverVersionCapture));
    Utils.setMockClock();
}
 
Example #6
Source File: ChannelTestUtils.java    From GreenBits with GNU General Public License v3.0 5 votes vote down vote up
public static RecordingPair makeRecorders(final Wallet serverWallet, final TransactionBroadcaster mockBroadcaster, int maxExpireTime) {
    RecordingPair pair = new RecordingPair();
    pair.serverRecorder = new RecordingServerConnection();
    pair.server = new PaymentChannelServer(mockBroadcaster, serverWallet, Coin.COIN, pair.serverRecorder);
    pair.clientRecorder = new RecordingClientConnection(maxExpireTime);
    return pair;
}
 
Example #7
Source File: ChannelTestUtils.java    From bcm-android with GNU General Public License v3.0 4 votes vote down vote up
public static RecordingPair makeRecorders(final Wallet serverWallet, final TransactionBroadcaster mockBroadcaster) {
    return makeRecorders(serverWallet, mockBroadcaster, RecordingClientConnection.IGNORE_EXPIRE);
}
 
Example #8
Source File: ChannelTestUtils.java    From green_android with GNU General Public License v3.0 4 votes vote down vote up
public static RecordingPair makeRecorders(final Wallet serverWallet, final TransactionBroadcaster mockBroadcaster) {
    return makeRecorders(serverWallet, mockBroadcaster, RecordingClientConnection.IGNORE_EXPIRE);
}
 
Example #9
Source File: ChannelTestUtils.java    From GreenBits with GNU General Public License v3.0 4 votes vote down vote up
public static RecordingPair makeRecorders(final Wallet serverWallet, final TransactionBroadcaster mockBroadcaster) {
    return makeRecorders(serverWallet, mockBroadcaster, RecordingClientConnection.IGNORE_EXPIRE);
}
 
Example #10
Source File: PaymentChannelServerListener.java    From bcm-android with GNU General Public License v3.0 3 votes vote down vote up
/**
 * Sets up a new payment channel server which listens on the given port.
 *
 * @param broadcaster            The PeerGroup on which transactions will be broadcast - should have multiple connections.
 * @param wallet                 The wallet which will be used to complete transactions
 * @param timeoutSeconds         The read timeout between messages. This should accommodate latency and client ECDSA
 *                               signature operations.
 * @param minAcceptedChannelSize The minimum amount of coins clients must lock in to create a channel. Clients which
 *                               are unwilling or unable to lock in at least this value will immediately disconnect.
 *                               For this reason, a fairly conservative value (in terms of average value spent on a
 *                               channel) should generally be chosen.
 * @param eventHandlerFactory    A factory which generates event handlers which are created for each new connection
 */
public PaymentChannelServerListener(TransactionBroadcaster broadcaster, Wallet wallet,
                                    final int timeoutSeconds, Coin minAcceptedChannelSize,
                                    HandlerFactory eventHandlerFactory) throws IOException {
    this.wallet = checkNotNull(wallet);
    this.broadcaster = checkNotNull(broadcaster);
    this.eventHandlerFactory = checkNotNull(eventHandlerFactory);
    this.minAcceptedChannelSize = checkNotNull(minAcceptedChannelSize);
    this.timeoutSeconds = timeoutSeconds;
}
 
Example #11
Source File: PaymentChannelServerListener.java    From green_android with GNU General Public License v3.0 3 votes vote down vote up
/**
 * Sets up a new payment channel server which listens on the given port.
 *
 * @param broadcaster The PeerGroup on which transactions will be broadcast - should have multiple connections.
 * @param wallet The wallet which will be used to complete transactions
 * @param timeoutSeconds The read timeout between messages. This should accommodate latency and client ECDSA
 *                       signature operations.
 * @param minAcceptedChannelSize The minimum amount of coins clients must lock in to create a channel. Clients which
 *                               are unwilling or unable to lock in at least this value will immediately disconnect.
 *                               For this reason, a fairly conservative value (in terms of average value spent on a
 *                               channel) should generally be chosen.
 * @param eventHandlerFactory A factory which generates event handlers which are created for each new connection
 */
public PaymentChannelServerListener(TransactionBroadcaster broadcaster, Wallet wallet,
                                    final int timeoutSeconds, Coin minAcceptedChannelSize,
                                    HandlerFactory eventHandlerFactory) throws IOException {
    this.wallet = checkNotNull(wallet);
    this.broadcaster = checkNotNull(broadcaster);
    this.eventHandlerFactory = checkNotNull(eventHandlerFactory);
    this.minAcceptedChannelSize = checkNotNull(minAcceptedChannelSize);
    this.timeoutSeconds = timeoutSeconds;
}
 
Example #12
Source File: PaymentChannelServerListener.java    From GreenBits with GNU General Public License v3.0 3 votes vote down vote up
/**
 * Sets up a new payment channel server which listens on the given port.
 *
 * @param broadcaster The PeerGroup on which transactions will be broadcast - should have multiple connections.
 * @param wallet The wallet which will be used to complete transactions
 * @param timeoutSeconds The read timeout between messages. This should accommodate latency and client ECDSA
 *                       signature operations.
 * @param minAcceptedChannelSize The minimum amount of coins clients must lock in to create a channel. Clients which
 *                               are unwilling or unable to lock in at least this value will immediately disconnect.
 *                               For this reason, a fairly conservative value (in terms of average value spent on a
 *                               channel) should generally be chosen.
 * @param eventHandlerFactory A factory which generates event handlers which are created for each new connection
 */
public PaymentChannelServerListener(TransactionBroadcaster broadcaster, Wallet wallet,
                                    final int timeoutSeconds, Coin minAcceptedChannelSize,
                                    HandlerFactory eventHandlerFactory) throws IOException {
    this.wallet = checkNotNull(wallet);
    this.broadcaster = checkNotNull(broadcaster);
    this.eventHandlerFactory = checkNotNull(eventHandlerFactory);
    this.minAcceptedChannelSize = checkNotNull(minAcceptedChannelSize);
    this.timeoutSeconds = timeoutSeconds;
}