org.bitcoinj.wallet.Wallet.receive()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(122)

本文整理了Java中org.bitcoinj.wallet.Wallet.receive()方法的一些代码示例,展示了Wallet.receive()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Wallet.receive()方法的具体详情如下:
包路径:org.bitcoinj.wallet.Wallet
类名称:Wallet
方法名:receive

Wallet.receive介绍

[英]Called by the BlockChain when we receive a new block that sends coins to one of our addresses or spends coins from one of our addresses (note that a single transaction can do both).

This is necessary for the internal book-keeping Wallet does. When a transaction is received that sends us coins it is added to a pool so we can use it later to create spends. When a transaction is received that consumes outputs they are marked as spent so they won't be used in future.

A transaction that spends our own coins can be received either because a spend we created was accepted by the network and thus made it into a block, or because our keys are being shared between multiple instances and some other node spent the coins instead. We still have to know about that to avoid accidentally trying to double spend.

A transaction may be received multiple times if is included into blocks in parallel chains. The blockType parameter describes whether the containing block is on the main/best chain or whether it's on a presently inactive side chain. We must still record these transactions and the blocks they appear in because a future block might change which chain is best causing a reorganize. A re-org can totally change our balance!
[中]

代码示例

代码示例来源:origin: HashEngineering/dashj

if (!isTransactionRelevant(tx))
    return;
  receive(tx, block, blockType, relativityOffset);
} finally {
  lock.unlock();

代码示例来源:origin: cash.bitcoinj/bitcoinj-core

if (!isTransactionRelevant(tx))
    return;
  receive(tx, block, blockType, relativityOffset);
} finally {
  lock.unlock();

代码示例来源:origin: fr.acinq/bitcoinj-core

if (!isTransactionRelevant(tx))
    return;
  receive(tx, block, blockType, relativityOffset);
} finally {
  lock.unlock();

代码示例来源:origin: greenaddress/GreenBits

if (!isTransactionRelevant(tx))
    return;
  receive(tx, block, blockType, relativityOffset);
} finally {
  lock.unlock();

代码示例来源:origin: cash.bitcoinj/bitcoinj-core

receive(tx, block, blockType, relativityOffset);
  return true;
} finally {

代码示例来源:origin: fr.acinq/bitcoinj-core

receive(tx, block, blockType, relativityOffset);
  return true;
} finally {

代码示例来源:origin: greenaddress/GreenBits

receive(tx, block, blockType, relativityOffset);
  return true;
} finally {

代码示例来源:origin: HashEngineering/dashj

receive(tx, block, blockType, relativityOffset);
  return true;
} finally {

代码示例来源:origin: cash.bitcoinj/bitcoinj-core

log.info("  tx {}", pair.tx.getHash());
try {
  receive(pair.tx, block, BlockChain.NewBlockType.BEST_CHAIN, pair.offset);
} catch (ScriptException e) {
  throw new RuntimeException(e);  // Cannot happen as these blocks were already verified.

代码示例来源:origin: fr.acinq/bitcoinj-core

log.info("  tx {}", pair.tx.getHash());
try {
  receive(pair.tx, block, BlockChain.NewBlockType.BEST_CHAIN, pair.offset);
} catch (ScriptException e) {
  throw new RuntimeException(e);  // Cannot happen as these blocks were already verified.

代码示例来源:origin: greenaddress/GreenBits

log.info("  tx {}", pair.tx.getHash());
try {
  receive(pair.tx, block, BlockChain.NewBlockType.BEST_CHAIN, pair.offset);
} catch (ScriptException e) {
  throw new RuntimeException(e);  // Cannot happen as these blocks were already verified.

代码示例来源:origin: HashEngineering/dashj

log.info("  tx {}", pair.tx.getHash());
try {
  receive(pair.tx, block, BlockChain.NewBlockType.BEST_CHAIN, pair.offset);
} catch (ScriptException e) {
  throw new RuntimeException(e);  // Cannot happen as these blocks were already verified.

相关文章

微信公众号

最新文章

更多

Wallet类方法