|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.bitcoin.store.MemoryBlockStore
public class MemoryBlockStore
Keeps StoredBlocks in memory. Used primarily for unit testing.
| Constructor Summary | |
|---|---|
MemoryBlockStore(NetworkParameters params)
|
|
| Method Summary | |
|---|---|
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. |
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MemoryBlockStore(NetworkParameters params)
| Method Detail |
|---|
public void put(StoredBlock block)
throws BlockStoreException
BlockStore
put in interface BlockStoreBlockStoreException
public StoredBlock get(Sha256Hash hash)
throws BlockStoreException
BlockStore
get in interface BlockStoreBlockStoreException
public StoredBlock getChainHead()
throws BlockStoreException
BlockStoreStoredBlock 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.
getChainHead in interface BlockStoreBlockStoreException
public void setChainHead(StoredBlock chainHead)
throws BlockStoreException
BlockStoreStoredBlock that represents the top of the chain of greatest total work.
setChainHead in interface BlockStoreBlockStoreExceptionpublic void close()
BlockStore
close in interface BlockStore
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||