public interface BlockStore
A BlockStore is a map of hashes to StoredBlock. The hash is the double digest of the Bitcoin serialization of the block header, not the header with the extra data as well.
BlockStores are thread safe.
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the store.
|
StoredBlock |
get(Sha256Hash hash)
Returns the StoredBlock given a hash.
|
StoredBlock |
getChainHead()
Returns the
StoredBlock that represents the top of the chain of greatest total work. |
NetworkParameters |
getParams()
Get the
NetworkParameters of this store. |
void |
put(StoredBlock block)
Saves the given block header+extra data.
|
void |
setChainHead(StoredBlock chainHead)
Sets the
StoredBlock that represents the top of the chain of greatest total work. |
void put(StoredBlock block) throws BlockStoreException
BlockStoreException
StoredBlock get(Sha256Hash hash) throws BlockStoreException
BlockStoreException
StoredBlock getChainHead() throws BlockStoreException
StoredBlock
that represents the top of the chain of greatest total work. Note that this
can be arbitrarily expensive, you probably should use AbstractBlockChain.getChainHead()
or perhaps AbstractBlockChain.getBestChainHeight()
which will run in constant time and
not take any heavyweight locks.BlockStoreException
void setChainHead(StoredBlock chainHead) throws BlockStoreException
StoredBlock
that represents the top of the chain of greatest total work.BlockStoreException
void close() throws BlockStoreException
BlockStoreException
NetworkParameters getParams()
NetworkParameters
of this store.Copyright © 2016. All rights reserved.