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


Java Wallet.getParams方法代码示例

本文整理汇总了Java中org.bitcoinj.wallet.Wallet.getParams方法的典型用法代码示例。如果您正苦于以下问题:Java Wallet.getParams方法的具体用法?Java Wallet.getParams怎么用?Java Wallet.getParams使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bitcoinj.wallet.Wallet的用法示例。


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

示例1: WalletController

import org.bitcoinj.wallet.Wallet; //导入方法依赖的package包/类
/** Constructs a new wallet controller object.
 * @param wallet The current wallet.
 * @param user The current user.
 * @author Francis Fasola */
public WalletController (Wallet wallet, User user) {
	this.wallet = wallet;
	params = wallet.getParams();
	this.user = user;
	loadUser();		
	addEventListeners();
}
 
开发者ID:FrankieF,项目名称:FJSTSeniorProjectSpring2017,代码行数:12,代码来源:WalletController.java

示例2: deserializeWalletExtension

import org.bitcoinj.wallet.Wallet; //导入方法依赖的package包/类
@Override
public void deserializeWalletExtension(Wallet containingWallet, byte[] data) throws Exception {
    lock.lock();
    try {
        this.wallet = containingWallet;
        ServerState.StoredServerPaymentChannels states = ServerState.StoredServerPaymentChannels.parseFrom(data);
        NetworkParameters params = containingWallet.getParams();
        for (ServerState.StoredServerPaymentChannel storedState : states.getChannelsList()) {
            final int majorVersion = storedState.getMajorVersion();
            TransactionOutput clientOutput = null;
            ECKey clientKey = null;
            if (majorVersion == 1) {
                clientOutput = new TransactionOutput(params, null, storedState.getClientOutput().toByteArray(), 0);
            } else {
                clientKey = ECKey.fromPublicOnly(storedState.getClientKey().toByteArray());
            }
            StoredServerChannel channel = new StoredServerChannel(null,
                    majorVersion,
                    params.getDefaultSerializer().makeTransaction(storedState.getContractTransaction().toByteArray()),
                    clientOutput,
                    storedState.getRefundTransactionUnlockTimeSecs(),
                    ECKey.fromPrivate(storedState.getMyKey().toByteArray()),
                    clientKey,
                    Coin.valueOf(storedState.getBestValueToMe()),
                    storedState.hasBestValueSignature() ? storedState.getBestValueSignature().toByteArray() : null);
            putChannel(channel);
        }
    } finally {
        lock.unlock();
    }
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:32,代码来源:StoredPaymentChannelServerStates.java

示例3: deserializeWalletExtension

import org.bitcoinj.wallet.Wallet; //导入方法依赖的package包/类
@Override
public void deserializeWalletExtension(Wallet containingWallet, byte[] data) throws Exception {
    lock.lock();
    try {
        checkState(this.containingWallet == null || this.containingWallet == containingWallet);
        this.containingWallet = containingWallet;
        NetworkParameters params = containingWallet.getParams();
        ClientState.StoredClientPaymentChannels states = ClientState.StoredClientPaymentChannels.parseFrom(data);
        for (ClientState.StoredClientPaymentChannel storedState : states.getChannelsList()) {
            Transaction refundTransaction = params.getDefaultSerializer().makeTransaction(storedState.getRefundTransaction().toByteArray());
            refundTransaction.getConfidence().setSource(TransactionConfidence.Source.SELF);
            ECKey myKey = (storedState.getMyKey().isEmpty()) ?
                    containingWallet.findKeyFromPubKey(storedState.getMyPublicKey().toByteArray()) :
                    ECKey.fromPrivate(storedState.getMyKey().toByteArray());
            ECKey serverKey = storedState.hasServerKey() ? ECKey.fromPublicOnly(storedState.getServerKey().toByteArray()) : null;
            StoredClientChannel channel = new StoredClientChannel(storedState.getMajorVersion(),
                    Sha256Hash.wrap(storedState.getId().toByteArray()),
                    params.getDefaultSerializer().makeTransaction(storedState.getContractTransaction().toByteArray()),
                    refundTransaction,
                    myKey,
                    serverKey,
                    Coin.valueOf(storedState.getValueToMe()),
                    Coin.valueOf(storedState.getRefundFees()),
                    storedState.getExpiryTime(),
                    false);
            if (storedState.hasCloseTransactionHash()) {
                Sha256Hash closeTxHash = Sha256Hash.wrap(storedState.getCloseTransactionHash().toByteArray());
                channel.close = containingWallet.getTransaction(closeTxHash);
            }
            putChannel(channel, false);
        }
    } finally {
        lock.unlock();
    }
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:36,代码来源:StoredPaymentChannelClientStates.java


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