From eeabb880cdd0bd6683156219f0656407d49fa20e Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Sun, 7 Aug 2016 12:35:57 +0200 Subject: [PATCH] Add fileAbsolutePath in BlockStoreExeption Cherry pick https://github.com/bisq-network/bitcoinj/commit/6c779d3ebfe4e3421ce59374f8f74f9bcfe0e60a --- core/src/main/java/org/bitcoinj/store/SPVBlockStore.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/bitcoinj/store/SPVBlockStore.java b/core/src/main/java/org/bitcoinj/store/SPVBlockStore.java index 8a3427780c8..ab74d9917ef 100644 --- a/core/src/main/java/org/bitcoinj/store/SPVBlockStore.java +++ b/core/src/main/java/org/bitcoinj/store/SPVBlockStore.java @@ -78,6 +78,7 @@ protected boolean removeEldestEntry(Map.Entry 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 @@ -85,6 +86,7 @@ protected boolean removeEldestEntry(Map.Entry entry) { */ public SPVBlockStore(NetworkParameters params, File file) throws BlockStoreException { checkNotNull(file); + fileAbsolutePath = file.getAbsolutePath(); this.params = checkNotNull(params); try { this.numHeaders = DEFAULT_NUM_HEADERS; @@ -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;