• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TransactionBroadcaster类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SingletonServiceFactory类代码示例发布时间:2022-05-22
下一篇:
Java DB类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap