novitski / bitcoinj

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

Precondition triggers on unspent pool during synch #555

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Version: 0.12-SNAPSHOT
Branch: hdw-alpha

When synchronising after deleting my .spvchain file I get several of the 
following stack traces appearing:

WARN  [2014-05-11 10:24:56,878] [NioClientManager] 
com.google.bitcoin.core.PeerSocketHandler: [184.99.95.240]:8333 - 
! java.lang.IllegalStateException: null
! at com.google.common.base.Preconditions.checkState(Preconditions.java:161) 
~[guava-16.0.1.jar:na]
! at com.google.bitcoin.core.Wallet.addWalletTransaction(Wallet.java:1714) 
~[bitcoinj-0.12-SNAPSHOT.jar:na]
! at com.google.bitcoin.core.Wallet.processTxFromBestChain(Wallet.java:1379) 
~[bitcoinj-0.12-SNAPSHOT.jar:na]
! at com.google.bitcoin.core.Wallet.receive(Wallet.java:1213) 
~[bitcoinj-0.12-SNAPSHOT.jar:na]
! at com.google.bitcoin.core.Wallet.receiveFromBlock(Wallet.java:1162) 
~[bitcoinj-0.12-SNAPSHOT.jar:na]
! at 
com.google.bitcoin.core.AbstractBlockChain.sendTransactionsToListener(AbstractBl
ockChain.java:736) ~[bitcoinj-0.12-SNAPSHOT.jar:na]
! at 
com.google.bitcoin.core.AbstractBlockChain.informListenerForNewTransactions(Abst
ractBlockChain.java:560) ~[bitcoinj-0.12-SNAPSHOT.jar:na]
! at 
com.google.bitcoin.core.AbstractBlockChain.informListenersForNewBlock(AbstractBl
ockChain.java:505) ~[bitcoinj-0.12-SNAPSHOT.jar:na]
! at 
com.google.bitcoin.core.AbstractBlockChain.connectBlock(AbstractBlockChain.java:
446) ~[bitcoinj-0.12-SNAPSHOT.jar:na]
! at 
com.google.bitcoin.core.AbstractBlockChain.add(AbstractBlockChain.java:397) 
~[bitcoinj-0.12-SNAPSHOT.jar:na]
! at 
com.google.bitcoin.core.AbstractBlockChain.add(AbstractBlockChain.java:281) 
~[bitcoinj-0.12-SNAPSHOT.jar:na]
! at com.google.bitcoin.core.BlockChain.add(BlockChain.java:123) 
~[bitcoinj-0.12-SNAPSHOT.jar:na]
! at com.google.bitcoin.core.Peer.endFilteredBlock(Peer.java:890) 
~[bitcoinj-0.12-SNAPSHOT.jar:na]
! at com.google.bitcoin.core.Peer.processMessage(Peer.java:322) 
~[bitcoinj-0.12-SNAPSHOT.jar:na]
! at 
com.google.bitcoin.core.PeerSocketHandler.receiveBytes(PeerSocketHandler.java:17
8) ~[bitcoinj-0.12-SNAPSHOT.jar:na]
! at 
com.google.bitcoin.net.ConnectionHandler.handleKey(ConnectionHandler.java:216) 
[bitcoinj-0.12-SNAPSHOT.jar:na]
! at 
com.google.bitcoin.net.NioClientManager.handleKey(NioClientManager.java:74) 
[bitcoinj-0.12-SNAPSHOT.jar:na]
! at com.google.bitcoin.net.NioClientManager.run(NioClientManager.java:110) 
[bitcoinj-0.12-SNAPSHOT.jar:na]
! at 
com.google.common.util.concurrent.AbstractExecutionThreadService$1$2.run(Abstrac
tExecutionThreadService.java:60) [guava-16.0.1.jar:na]
! at com.google.common.util.concurrent.Callables$3.run(Callables.java:93) 
[guava-16.0.1.jar:na]
! at java.lang.Thread.run(Thread.java:744) [na:1.7.0_51]

DEBUG [2014-05-11 10:24:56,879] [bitcoinj user thread] 
org.multibit.hd.core.network.MultiBitPeerEventListener: Chain download started 
with number of blocks left = 298

ERROR [2014-05-11 10:24:56,879] [NioClientManager] 
com.google.bitcoin.net.ConnectionHandler: Error handling SelectionKey: null

It appears to be caused by the addition of a duplicate transaction to the 
unspent pool which is not expected to happen. Is this check too harsh?

I've included the whole stack trace and some additional logging in case the 
trailing messages are useful. 

It might be similar to an issue present in #366 which Andreas spotted but 
regarded as invalid due to not correctly clearing out his wallet.

The UI effect (in MBHD) is for synch to restart from 0% and try again and again 
until it eventually achieves 100% but this is less than smooth and looks a bit 
flaky.

Original issue reported on code.google.com by g.rowe.f...@gmail.com on 11 May 2014 at 4:04

GoogleCodeExporter commented 9 years ago
You probably forgot to call wallet.clearTransactions(0) after deleting the 
spvchain file. I guess we could make the assert error more informative for that 
case.

Original comment by mh.in.en...@gmail.com on 11 May 2014 at 4:12

GoogleCodeExporter commented 9 years ago
Was this an acceptable resolution? Closing as I think that was the cause of the 
issue.

Original comment by mh.in.en...@gmail.com on 3 Aug 2014 at 7:18