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


Java VerificationException.printStackTrace方法代码示例

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


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

示例1: claimMoney

import com.google.bitcoin.core.VerificationException; //导入方法依赖的package包/类
public void claimMoney() throws IOException {
	boolean testnet = parameters.isTestnet();
	ComputeTx computeTx = ioHandler.askCompute(new InputVerifiers.ComputeTxVerifier(testnet));
	memoryStorage.saveTransaction(parameters, computeTx);
	
	List<byte[]> hashes = computeTx.getSecretsHashes();
	int minLength = computeTx.getMinLength();
	List<byte[]> secrets = ioHandler.askSecrets(hashes, 
			new InputVerifiers.SecretListVerifier(null, hashes, minLength, testnet));
	memoryStorage.saveSecrets(parameters, secrets);
	
	int winner = 0;
	Address winersAddress = null;
	try {
		winner = computeTx.getWinner(secrets);
		winersAddress = computeTx.getAddress(winner);
	} catch (VerificationException e1) {// can not happen
		e1.printStackTrace();
	}
	ioHandler.showWinner(winner, winersAddress);
	byte[] pkHash = winersAddress.getHash160();
	NetworkParameters params = LotteryTx.getNetworkParameters(testnet);
	ECKey sk = ioHandler.askSK(new InputVerifiers.SkVerifier(pkHash, testnet));
	Address address = ioHandler.askAddress(sk.toAddress(params), new InputVerifiers.AddressVerifier(testnet));
	BigInteger fee = ioHandler.askFee(new InputVerifiers.FeeVerifier(computeTx.getValue(0)));
	ClaimTx claimMoneyTx = null;
	try {
		claimMoneyTx = new ClaimTx(computeTx, secrets, sk, address, fee, testnet);
	} catch (VerificationException e) {// can not happen
		e.printStackTrace();
	}
	File claimMoneyFile = memoryStorage.saveTransaction(parameters, claimMoneyTx);
	ioHandler.showClaimMoney(claimMoneyTx, claimMoneyFile.getParent());
}
 
开发者ID:lukmaz,项目名称:BitcoinLottery,代码行数:35,代码来源:MoneyClaimer.java

示例2: executionPhase

import com.google.bitcoin.core.VerificationException; //导入方法依赖的package包/类
protected void executionPhase() throws IOException {
	ioHandler.showLotteryPhase(LotteryPhases.EXECUTION_PHASE);
	boolean testnet = parameters.isTestnet();
	List<PutMoneyTx> putMoneyTxs = ioHandler.askPutMoney(noPlayers, stake, 
			new InputVerifiers.PutMoneyVerifier(pks, stake, testnet));
	memoryStorage.saveTransactions(parameters, putMoneyTxs);
	try {
		computeTx = new ComputeTx(putMoneyTxs, pks, hashes, minLength, fee, testnet);
	} catch (VerificationException e1) { //cannot happen
		e1.printStackTrace();
	}
	byte[] computeSig = null;
	try {
		computeSig = computeTx.addSignature(position, sk);
	} catch (VerificationException e) {
		// TODO should not happen
		e.printStackTrace();
	}

	if (position == 0) {
		SignaturesVerifier sigVerifier = new InputVerifiers.SignaturesVerifier(computeTx);
		ioHandler.askSignatures(noPlayers, position, sigVerifier);
		ioHandler.showCompute(computeTx);
	}
	else {
		ioHandler.showSignature(computeSig);
		computeTx = ioHandler.askCompute(new InputVerifiers.SignedComputeTxVerifier(computeTx, pks, putMoneyTxs, testnet));
	}
	memoryStorage.saveTransaction(parameters, computeTx);
}
 
开发者ID:lukmaz,项目名称:BitcoinLottery,代码行数:31,代码来源:Lottery.java

示例3: claimMoneyPhase

import com.google.bitcoin.core.VerificationException; //导入方法依赖的package包/类
protected void claimMoneyPhase() throws IOException { //TODO: extract common part with MoneyClaimer ?
	ioHandler.showLotteryPhase(LotteryPhases.CLAIM_MONEY_PHASE);
	boolean testnet = parameters.isTestnet();
	List<byte[]> secrets = ioHandler.askSecretsOrOpens(noPlayers, position, 
			new InputVerifiers.SecretListVerifier(position, hashes, minLength, testnet));
	secrets.set(position, secret);
	memoryStorage.saveSecrets(parameters, secrets);
	
	int winner = 0;
	try {
		winner = computeTx.getWinner(secrets);
	} catch (VerificationException e1) {// can not happen
		e1.printStackTrace();
	}
	if (winner == position) {
		ioHandler.showWin();
		NetworkParameters params = LotteryTx.getNetworkParameters(testnet);
		Address address = ioHandler.askAddress(sk.toAddress(params), new InputVerifiers.AddressVerifier(testnet));
		ClaimTx claimMoneyTx = null;
		try {
			claimMoneyTx = new ClaimTx(computeTx, secrets, sk, address, fee, testnet);
		} catch (VerificationException e) {// can not happen
			e.printStackTrace();
		}
		File claimMoneyFile = memoryStorage.saveTransaction(parameters, claimMoneyTx);
		ioHandler.showClaimMoney(claimMoneyTx, claimMoneyFile.getParent());
	}
	else {
		ioHandler.showLost(winner, computeTx.getAddress(winner));
	}
}
 
开发者ID:lukmaz,项目名称:BitcoinLottery,代码行数:32,代码来源:Lottery.java

示例4: getCheckpointBeforeOrAtHeight

import com.google.bitcoin.core.VerificationException; //导入方法依赖的package包/类
/**
 * Returns a {@link StoredBlock} representing the last checkpoint before the given block height, for example, normally
 * you would want to know the checkpoint before the last block the wallet had seen.
 */
public StoredBlock getCheckpointBeforeOrAtHeight(int height) {
    Map.Entry<Long, StoredBlock> highestCheckpointBeforeHeight = null;
    
    for (Map.Entry<Long, StoredBlock> loop : checkpoints.entrySet()) {
        if (loop.getValue().getHeight() < height) {
            // This checkpoint is before the specified height.
            if (highestCheckpointBeforeHeight == null) {
                highestCheckpointBeforeHeight = loop;
            } else {
                if (highestCheckpointBeforeHeight.getValue().getHeight() < loop.getValue().getHeight()) {
                    // This entry is later.
                    highestCheckpointBeforeHeight = loop;
                }
            }
        }
    }
    
    if (highestCheckpointBeforeHeight == null) {
        try {
            return new StoredBlock(params.getGenesisBlock(), params.getGenesisBlock().getWork(), 0);
        } catch (VerificationException e) {
            e.printStackTrace();
        }
    }
    return highestCheckpointBeforeHeight.getValue();
}
 
开发者ID:coinspark,项目名称:sparkbit,代码行数:31,代码来源:MultiBitCheckpointManager.java


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