|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface BlockStore
An implementor of BlockStore saves StoredBlock objects to disk. Different implementations store them in different ways. An in-memory implementation (MemoryBlockStore) exists for unit testing but real apps will want to use implementations that save to disk.
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.
Method Summary | |
---|---|
StoredBlock |
get(byte[] hash)
Returns the StoredBlock given a hash. |
StoredBlock |
getChainHead()
Returns the StoredBlock that represents the top of the chain of greatest total work. |
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. |
Method Detail |
---|
void put(StoredBlock block) throws BlockStoreException
BlockStoreException
StoredBlock get(byte[] hash) throws BlockStoreException
BlockStoreException
StoredBlock getChainHead() throws BlockStoreException
StoredBlock
that represents the top of the chain of greatest total work.
BlockStoreException
void setChainHead(StoredBlock chainHead) throws BlockStoreException
StoredBlock
that represents the top of the chain of greatest total work.
BlockStoreException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |