novitski / bitcoinj

Automatically exported from code.google.com/p/bitcoinj
Apache License 2.0
0 stars 0 forks source link

NPE in SPVBlockStore.getChainHead() #374

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I've got a corrupted block chain file. However, getChainHead() throws NPE 
rather than the documented BlockStoreException. Because of this, Bitcoin Wallet 
does not try to recover from that situation.

E/AndroidRuntime(24091): java.lang.RuntimeException: Unable to create service 
de.schildbach.wallet.service.BlockchainServiceImpl: 
java.lang.NullPointerException: Corrupted block store: could not find chain 
head: 00000000a695a90b6e3df140d194a9bdb596dd946c648b3c93211a3c9011daa7
E/AndroidRuntime(24091):    at 
android.app.ActivityThread.handleCreateService(ActivityThread.java:2539)
E/AndroidRuntime(24091):    at 
android.app.ActivityThread.access$1600(ActivityThread.java:141)
E/AndroidRuntime(24091):    at 
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
E/AndroidRuntime(24091):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(24091):    at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(24091):    at 
android.app.ActivityThread.main(ActivityThread.java:5041)
E/AndroidRuntime(24091):    at java.lang.reflect.Method.invokeNative(Native 
Method)
E/AndroidRuntime(24091):    at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(24091):    at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
E/AndroidRuntime(24091):    at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
E/AndroidRuntime(24091):    at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(24091): Caused by: java.lang.NullPointerException: Corrupted 
block store: could not find chain head: 
00000000a695a90b6e3df140d194a9bdb596dd946c648b3c93211a3c9011daa7
E/AndroidRuntime(24091):    at 
com.google.common.base.Preconditions.checkNotNull(Preconditions.java:208)
E/AndroidRuntime(24091):    at 
com.google.bitcoin.store.SPVBlockStore.getChainHead(SPVBlockStore.java:242)
E/AndroidRuntime(24091):    at 
de.schildbach.wallet.service.BlockchainServiceImpl.onCreate(BlockchainServiceImp
l.java:590)
E/AndroidRuntime(24091):    at 
android.app.ActivityThread.handleCreateService(ActivityThread.java:2529)
E/AndroidRuntime(24091):    ... 10 more

Original issue reported on code.google.com by andreas....@gmail.com on 27 Mar 2013 at 3:51

GoogleCodeExporter commented 9 years ago
A fix for this is on my repo: a814d60c6b359b23f4ee59e8a3ad1d356db7752e

Original comment by andreas....@gmail.com on 28 Mar 2013 at 1:55

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 4f1c7f4816db.

Original comment by hearn@google.com on 29 Mar 2013 at 4:42