本文整理了Java中org.bitcoinj.core.Block.getHash()
方法的一些代码示例,展示了Block.getHash()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Block.getHash()
方法的具体详情如下:
包路径:org.bitcoinj.core.Block
类名称:Block
方法名:getHash
[英]Returns the hash of the block (which for a valid, solved block should be below the target). Big endian.
[中]返回块的哈希值(对于有效的已求解块,哈希值应低于目标值)。大恩迪安。
代码示例来源:origin: greenaddress/GreenBits
/** Gets the hash of the block represented in this Filtered Block */
@Override
public Sha256Hash getHash() {
return header.getHash();
}
代码示例来源:origin: fr.acinq/bitcoinj-core
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
return getHash().equals(((Block)o).getHash());
}
代码示例来源:origin: fr.acinq/bitcoinj-core
/** Copy the block without transactions into the provided empty block. */
protected final void copyBitcoinHeaderTo(final Block block) {
block.nonce = nonce;
block.prevBlockHash = prevBlockHash;
block.merkleRoot = getMerkleRoot();
block.version = version;
block.time = time;
block.difficultyTarget = difficultyTarget;
block.transactions = null;
block.hash = getHash();
}
代码示例来源:origin: greenaddress/GreenBits
/**
* Returns the hash of the block (which for a valid, solved block should be below the target) in the form seen on
* the block explorer. If you call this on block 1 in the mainnet chain
* you will get "00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048".
*/
public String getHashAsString() {
return getHash().toString();
}
代码示例来源:origin: cash.bitcoinj/bitcoinj-core
/**
* Returns the hash of the block (which for a valid, solved block should be below the target) in the form seen on
* the block explorer. If you call this on block 1 in the mainnet chain
* you will get "00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048".
*/
public String getHashAsString() {
return getHash().toString();
}
代码示例来源:origin: cash.bitcoinj/bitcoinj-core
/** Copy the block without transactions into the provided empty block. */
protected final void copyBitcoinHeaderTo(final Block block) {
block.nonce = nonce;
block.prevBlockHash = prevBlockHash;
block.merkleRoot = getMerkleRoot();
block.version = version;
block.time = time;
block.difficultyTarget = difficultyTarget;
block.transactions = null;
block.hash = getHash();
}
代码示例来源:origin: cash.bitcoinj/bitcoinj-core
@Override
public synchronized final void put(StoredBlock block) throws BlockStoreException {
if (blockMap == null) throw new BlockStoreException("MemoryBlockStore is closed");
Sha256Hash hash = block.getHeader().getHash();
blockMap.put(hash, block);
}
代码示例来源:origin: fr.acinq/bitcoinj-core
@Override
public synchronized final void put(StoredBlock block) throws BlockStoreException {
if (blockMap == null) throw new BlockStoreException("MemoryBlockStore is closed");
Sha256Hash hash = block.getHeader().getHash();
blockMap.put(hash, block);
}
代码示例来源:origin: cash.bitcoinj/bitcoinj-core
@Override
public synchronized void put(StoredBlock block) throws BlockStoreException {
Preconditions.checkNotNull(blockMap, "MemoryFullPrunedBlockStore is closed");
Sha256Hash hash = block.getHeader().getHash();
blockMap.put(hash, new StoredBlockAndWasUndoableFlag(block, false));
}
代码示例来源:origin: fr.acinq/bitcoinj-core
@Override
public synchronized void put(StoredBlock block) throws BlockStoreException {
buffer.clear();
block.serializeCompact(buffer);
db.put(block.getHeader().getHash().getBytes(), buffer.array());
}
代码示例来源:origin: HashEngineering/dashj
@Override
public synchronized void put(StoredBlock block) throws BlockStoreException {
buffer.clear();
block.serializeCompact(buffer);
db.put(block.getHeader().getHash().getBytes(), buffer.array());
}
代码示例来源:origin: cash.bitcoinj/bitcoinj-core
@Override
public void setChainHead(StoredBlock chainHead) throws BlockStoreException {
final MappedByteBuffer buffer = this.buffer;
if (buffer == null) throw new BlockStoreException("Store closed");
lock.lock();
try {
lastChainHead = chainHead;
byte[] headHash = chainHead.getHeader().getHash().getBytes();
buffer.position(8);
buffer.put(headHash);
} finally { lock.unlock(); }
}
代码示例来源:origin: greenaddress/GreenBits
@Override
public void setChainHead(StoredBlock chainHead) throws BlockStoreException {
final MappedByteBuffer buffer = this.buffer;
if (buffer == null) throw new BlockStoreException("Store closed");
lock.lock();
try {
lastChainHead = chainHead;
byte[] headHash = chainHead.getHeader().getHash().getBytes();
buffer.position(8);
buffer.put(headHash);
} finally { lock.unlock(); }
}
代码示例来源:origin: cash.bitcoinj/bitcoinj-core
@Override
public synchronized final void put(StoredBlock storedBlock, StoredUndoableBlock undoableBlock) throws BlockStoreException {
Preconditions.checkNotNull(blockMap, "MemoryFullPrunedBlockStore is closed");
Sha256Hash hash = storedBlock.getHeader().getHash();
fullBlockMap.put(hash, storedBlock.getHeight(), undoableBlock);
blockMap.put(hash, new StoredBlockAndWasUndoableFlag(storedBlock, true));
}
代码示例来源:origin: fr.acinq/bitcoinj-core
@Override
public synchronized final void put(StoredBlock storedBlock, StoredUndoableBlock undoableBlock) throws BlockStoreException {
Preconditions.checkNotNull(blockMap, "MemoryFullPrunedBlockStore is closed");
Sha256Hash hash = storedBlock.getHeader().getHash();
fullBlockMap.put(hash, storedBlock.getHeight(), undoableBlock);
blockMap.put(hash, new StoredBlockAndWasUndoableFlag(storedBlock, true));
}
代码示例来源:origin: cash.bitcoinj/bitcoinj-core
@Override
protected StoredBlock addToBlockStore(StoredBlock storedPrev, Block block)
throws BlockStoreException, VerificationException {
StoredBlock newBlock = storedPrev.build(block);
blockStore.put(newBlock, new StoredUndoableBlock(newBlock.getHeader().getHash(), block.transactions));
return newBlock;
}
代码示例来源:origin: fr.acinq/bitcoinj-core
@Override
protected StoredBlock addToBlockStore(StoredBlock storedPrev, Block header, TransactionOutputChanges txOutChanges)
throws BlockStoreException, VerificationException {
StoredBlock newBlock = storedPrev.build(header);
blockStore.put(newBlock, new StoredUndoableBlock(newBlock.getHeader().getHash(), txOutChanges));
return newBlock;
}
代码示例来源:origin: fr.acinq/bitcoinj-core
@Override
protected StoredBlock addToBlockStore(StoredBlock storedPrev, Block block)
throws BlockStoreException, VerificationException {
StoredBlock newBlock = storedPrev.build(block);
blockStore.put(newBlock, new StoredUndoableBlock(newBlock.getHeader().getHash(), block.transactions));
return newBlock;
}
代码示例来源:origin: cash.bitcoinj/bitcoinj-core
@Override
protected StoredBlock addToBlockStore(StoredBlock storedPrev, Block header, TransactionOutputChanges txOutChanges)
throws BlockStoreException, VerificationException {
StoredBlock newBlock = storedPrev.build(header);
blockStore.put(newBlock, new StoredUndoableBlock(newBlock.getHeader().getHash(), txOutChanges));
return newBlock;
}
代码示例来源:origin: fr.acinq/bitcoinj-core
@Override
public void setChainHead(StoredBlock chainHead) throws BlockStoreException {
if (instrument)
beginMethod("setChainHead");
Sha256Hash hash = chainHead.getHeader().getHash();
this.chainHeadHash = hash;
this.chainHeadBlock = chainHead;
batchPut(getKey(KeyType.CHAIN_HEAD_SETTING), hash.getBytes());
if (instrument)
endMethod("setChainHead");
}
内容来源于网络,如有侵权,请联系作者删除!