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


Java AbstractBlockChain.NewBlockType方法代码示例

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


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

示例1: receiveFromBlock

import org.bitcoinj.core.AbstractBlockChain; //导入方法依赖的package包/类
@Override
public void receiveFromBlock(Transaction tx, StoredBlock block, AbstractBlockChain.NewBlockType blockType, int relativityOffset) throws VerificationException {
    //Log.d("TransactionIsInBlock",block.toString());

    synchronized (transactions) {
        countTransactions++;
        transactions.add(tx);
        if (transactions.size() >= 30) {
            transactions.remove(10);
        }
    }

    if(System.currentTimeMillis()-lastTimestamp>1000) {
        refreshUI();
        lastTimestamp = System.currentTimeMillis();
    }
}
 
开发者ID:lvaccaro,项目名称:BitcoinBlockExplorer,代码行数:18,代码来源:FragmentTxs.java

示例2: receiveFromBlock

import org.bitcoinj.core.AbstractBlockChain; //导入方法依赖的package包/类
@Override
public void receiveFromBlock(Transaction tx, StoredBlock block, AbstractBlockChain.NewBlockType blockType, int relativityOffset) throws VerificationException {
    // TODO: use BIP 113 timestamps
    if ( (new Date().getTime() / 1000 ) - block.getHeader().getTimeSeconds() > 366 * 24 * 60 * 60) {
        log.debug("NameDB skipping new transaction at height " + block.getHeight() + " due to timestamp " + block.getHeader().getTimeSeconds());
        return;
    }
    
    for (TransactionOutput output : tx.getOutputs()) {
        try {
            Script scriptPubKey = output.getScriptPubKey();
            NameScript ns = new NameScript(scriptPubKey);
            // Always save the coinbase, because it lets us identify that we've received the contents of the block, even if it has no name_anyupdate operations.
            // TODO: maybe save a null reference instead of the actual coinbase tx, since this would cut down on memory usage very slightly.
            if(tx.isCoinBase() || ( ns.isNameOp() && ns.isAnyUpdate() ) ) {
                log.debug("NameDB temporarily storing name transaction until it gets more confirmations.");
                pendingBlockTransactions.put(block.getHeader().getHash(), tx);
            }
        } catch (ScriptException e) {
            // Our threat model is lightweight SPV, which means we
            // don't attempt to reject a blockchain due to a single
            // invalid transaction.  As such, if we see a
            // ScriptException, we just discard the transaction
            // (and log a warning) rather than rejecting the block.
            log.warn("Error checking TransactionOutput for name_anyupdate script!", e);
            continue;
        }
    }
}
 
开发者ID:dogecoin,项目名称:libdohj,代码行数:30,代码来源:NameLookupLatestLevelDBTransactionCache.java

示例3: receiveFromBlock

import org.bitcoinj.core.AbstractBlockChain; //导入方法依赖的package包/类
@Override
public void receiveFromBlock(Transaction tx, StoredBlock block, AbstractBlockChain.NewBlockType blockType, int relativityOffset) throws VerificationException {
    Log.i(TAG, "receiveFromBlock " + tx.getHashAsString() + " in block " + block);

    EWWalletService ewWalletService = ewApplication.getEwWalletService();

    if(ewWalletService!=null) {
        ewWalletService.refreshNextsAndAlias();
    }

    createNotification(tx);
    //TODO add listener to confidence change
}
 
开发者ID:RCasatta,项目名称:EternityWallAndroid,代码行数:14,代码来源:MyBlockchainListener.java

示例4: notifyTransactionIsInBlock

import org.bitcoinj.core.AbstractBlockChain; //导入方法依赖的package包/类
@Override
public boolean notifyTransactionIsInBlock(Sha256Hash txHash, StoredBlock block, AbstractBlockChain.NewBlockType blockType, int relativityOffset) throws VerificationException {
    Log.i(TAG,"notifyTransactionIsInBlock " + txHash.toString());
    //TODO write notification code here

    return false;
}
 
开发者ID:RCasatta,项目名称:EternityWallAndroid,代码行数:8,代码来源:MyBlockchainListener.java

示例5: notifyTransactionIsInBlock

import org.bitcoinj.core.AbstractBlockChain; //导入方法依赖的package包/类
@Override
public boolean notifyTransactionIsInBlock(Sha256Hash txHash, StoredBlock block, AbstractBlockChain.NewBlockType blockType, int relativityOffset) throws VerificationException {
    //Log.d("TransactionIsInBlock",block.toString());
    return false;
}
 
开发者ID:lvaccaro,项目名称:BitcoinBlockExplorer,代码行数:6,代码来源:FragmentTxs.java

示例6: notifyTransactionIsInBlock

import org.bitcoinj.core.AbstractBlockChain; //导入方法依赖的package包/类
@Override
public boolean notifyTransactionIsInBlock(Sha256Hash txHash, StoredBlock block, AbstractBlockChain.NewBlockType blockType, int relativityOffset) throws VerificationException {
    return false;
}
 
开发者ID:dogecoin,项目名称:libdohj,代码行数:5,代码来源:NameLookupLatestLevelDBTransactionCache.java

示例7: receiveFromBlock

import org.bitcoinj.core.AbstractBlockChain; //导入方法依赖的package包/类
@Override
public void receiveFromBlock(Transaction tx, StoredBlock block, AbstractBlockChain.NewBlockType blockType, int relativityOffset) throws VerificationException {

}
 
开发者ID:RCasatta,项目名称:EternityWallAndroid,代码行数:5,代码来源:EWChainListener.java


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