本文整理汇总了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();
}
}
示例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;
}
}
}
示例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
}
示例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;
}
示例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;
}
示例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;
}
示例7: receiveFromBlock
import org.bitcoinj.core.AbstractBlockChain; //导入方法依赖的package包/类
@Override
public void receiveFromBlock(Transaction tx, StoredBlock block, AbstractBlockChain.NewBlockType blockType, int relativityOffset) throws VerificationException {
}