当前位置: 首页>>代码示例>>Java>>正文


Java TransactionBroadcaster类代码示例

本文整理汇总了Java中com.google.bitcoin.core.TransactionBroadcaster的典型用法代码示例。如果您正苦于以下问题:Java TransactionBroadcaster类的具体用法?Java TransactionBroadcaster怎么用?Java TransactionBroadcaster使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TransactionBroadcaster类属于com.google.bitcoin.core包,在下文中一共展示了TransactionBroadcaster类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: PaymentChannelServerListener

import com.google.bitcoin.core.TransactionBroadcaster; //导入依赖的package包/类
/**
 * 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, BigInteger minAcceptedChannelSize,
                                    HandlerFactory eventHandlerFactory) throws IOException {
    this.wallet = checkNotNull(wallet);
    this.broadcaster = checkNotNull(broadcaster);
    this.eventHandlerFactory = checkNotNull(eventHandlerFactory);
    this.minAcceptedChannelSize = checkNotNull(minAcceptedChannelSize);

    server = new NioServer(new StreamParserFactory() {
        @Override
        public ProtobufParser getNewParser(InetAddress inetAddress, int port) {
            return new ServerHandler(new InetSocketAddress(inetAddress, port), timeoutSeconds).socketProtobufHandler;
        }
    });
}
 
开发者ID:sserrano44,项目名称:bitcoinj-watcher-service,代码行数:29,代码来源:PaymentChannelServerListener.java

示例2: makeRecorders

import com.google.bitcoin.core.TransactionBroadcaster; //导入依赖的package包/类
public static RecordingPair makeRecorders(final Wallet serverWallet, final TransactionBroadcaster mockBroadcaster) {
    RecordingPair pair = new RecordingPair();
    pair.serverRecorder = new RecordingServerConnection();
    pair.server = new PaymentChannelServer(mockBroadcaster, serverWallet, Utils.COIN, pair.serverRecorder);
    pair.clientRecorder = new RecordingClientConnection();
    return pair;
}
 
开发者ID:HashEngineering,项目名称:megacoinj,代码行数:8,代码来源:ChannelTestUtils.java

示例3: broadcastTransaction

import com.google.bitcoin.core.TransactionBroadcaster; //导入依赖的package包/类
public void broadcastTransaction(final TransactionBroadcaster broadcaster,
                                 final Transaction tx) {
    new Thread() {
        @Override
        public void run() {
            // Handle the future results just for logging.
            try {
                Futures.addCallback(broadcaster.broadcastTransaction(tx),
                                    new FutureCallback<Transaction>() {
                    @Override
                    public void onSuccess(Transaction transaction) {
                        mLogger.info("Successfully broadcast sweep tx: {}",
                                     transaction);
                    }

                    @Override
                    public void onFailure(Throwable throwable) {
                        mLogger.error("Failed to broadcast sweep tx",
                                      throwable);
                    }
                });
            } catch (Exception e) {
                mLogger.error("Failed to broadcast sweep tx", e);
            }
        }
    }.start();
}
 
开发者ID:ksedgwic,项目名称:BTCReceive,代码行数:28,代码来源:WalletService.java

示例4: PaymentChannelServerListener

import com.google.bitcoin.core.TransactionBroadcaster; //导入依赖的package包/类
/**
 * 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, BigInteger minAcceptedChannelSize,
                                    HandlerFactory eventHandlerFactory) throws IOException {
    this.wallet = checkNotNull(wallet);
    this.broadcaster = checkNotNull(broadcaster);
    this.eventHandlerFactory = checkNotNull(eventHandlerFactory);
    this.minAcceptedChannelSize = checkNotNull(minAcceptedChannelSize);
    this.timeoutSeconds = timeoutSeconds;
}
 
开发者ID:HashEngineering,项目名称:megacoinj,代码行数:23,代码来源:PaymentChannelServerListener.java


注:本文中的com.google.bitcoin.core.TransactionBroadcaster类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。