public class LevelDBBlockStore extends Object implements BlockStore
SPVBlockStore. If all you want is a regular wallet you don't need this class: it exists for
specialised applications where you need to quickly verify a standalone SPV proof.| Constructor and Description |
|---|
LevelDBBlockStore(Context context,
File directory)
Creates a LevelDB SPV block store using the JNI/C++ version of LevelDB.
|
LevelDBBlockStore(Context context,
File directory,
org.iq80.leveldb.DBFactory dbFactory)
Creates a LevelDB SPV block store using the given factory, which is useful if you want a pure Java version.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the store.
|
void |
destroy() |
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 |
reset()
Erases the contents of the database (but NOT the underlying files themselves) and then reinitialises with the genesis block.
|
void |
setChainHead(StoredBlock chainHead)
Sets the
StoredBlock that represents the top of the chain of greatest total work. |
public LevelDBBlockStore(Context context, File directory) throws BlockStoreException
BlockStoreExceptionpublic LevelDBBlockStore(Context context, File directory, org.iq80.leveldb.DBFactory dbFactory) throws BlockStoreException
BlockStoreExceptionpublic void put(StoredBlock block) throws BlockStoreException
BlockStoreput in interface BlockStoreBlockStoreException@Nullable public StoredBlock get(Sha256Hash hash) throws BlockStoreException
BlockStoreget in interface BlockStoreBlockStoreExceptionpublic 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 BlockStoreBlockStoreExceptionpublic void setChainHead(StoredBlock chainHead) throws BlockStoreException
BlockStoreStoredBlock that represents the top of the chain of greatest total work.setChainHead in interface BlockStoreBlockStoreExceptionpublic void close()
throws BlockStoreException
BlockStoreclose in interface BlockStoreBlockStoreExceptionpublic void reset()
throws BlockStoreException
BlockStoreExceptionpublic void destroy()
throws IOException
IOExceptionpublic NetworkParameters getParams()
BlockStoreNetworkParameters of this store.getParams in interface BlockStoreCopyright © 2015. All rights reserved.