本文整理汇总了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();
}
示例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();
}
}
示例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();
}
}