Skip to content

Commit

Permalink
Add fileAbsolutePath in BlockStoreExeption
Browse files Browse the repository at this point in the history
  • Loading branch information
ManfredKarrer authored and oscarguindzberg committed Dec 20, 2018
1 parent 7cb2f4e commit eeabb88
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions core/src/main/java/org/bitcoinj/store/SPVBlockStore.java
Expand Up @@ -78,13 +78,15 @@ protected boolean removeEldestEntry(Map.Entry<Sha256Hash, Object> entry) {
// Used to stop other applications/processes from opening the store.
protected FileLock fileLock = null;
protected RandomAccessFile randomAccessFile = null;
private final String fileAbsolutePath;

/**
* Creates and initializes an SPV block store. Will create the given file if it's missing. This operation
* will block on disk.
*/
public SPVBlockStore(NetworkParameters params, File file) throws BlockStoreException {
checkNotNull(file);
fileAbsolutePath = file.getAbsolutePath();
this.params = checkNotNull(params);
try {
this.numHeaders = DEFAULT_NUM_HEADERS;
Expand Down Expand Up @@ -236,8 +238,9 @@ public StoredBlock getChainHead() throws BlockStoreException {
buffer.get(headHash);
Sha256Hash hash = Sha256Hash.wrap(headHash);
StoredBlock block = get(hash);
if (block == null)
throw new BlockStoreException("Corrupted block store: could not find chain head: " + hash);
if (block == null)
throw new BlockStoreException("Corrupted block store: could not find chain head: " + hash
+"\nFile path: "+ fileAbsolutePath);
lastChainHead = block;
}
return lastChainHead;
Expand Down

0 comments on commit eeabb88

Please sign in to comment.