Skip to content

Commit

Permalink
Add fileAbsolutePath in BlockStoreExeption.
Browse files Browse the repository at this point in the history
Cherry pick 1a328ec
  • Loading branch information
ManfredKarrer authored and oscarguindzberg committed May 16, 2020
1 parent 7022b7f commit 5eecb19
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
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ protected boolean removeEldestEntry(Map.Entry<Sha256Hash, Object> entry) {
protected FileLock fileLock = null;
protected RandomAccessFile randomAccessFile = null;
private int fileLength;
private final String fileAbsolutePath;

/**
* Creates and initializes an SPV block store that can hold {@link #DEFAULT_CAPACITY} block headers. Will create the
Expand All @@ -100,6 +101,7 @@ public SPVBlockStore(NetworkParameters params, File file) throws BlockStoreExcep
*/
public SPVBlockStore(NetworkParameters params, File file, int capacity, boolean grow) throws BlockStoreException {
checkNotNull(file);
fileAbsolutePath = file.getAbsolutePath();
this.params = checkNotNull(params);
checkArgument(capacity > 0);
try {
Expand Down Expand Up @@ -261,8 +263,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 5eecb19

Please sign in to comment.