Unlock TransactionConfidence event listeners, make sure MemoryPool is not locked when a tx is marked broadcast by a peer to avoid inversions via listeners.

Unfortunately this introduces some new FindBugs warnings because it doesn't understand the inside-out locking pattern used here, despite that it's correct.
Update issue 233.
This commit is contained in:
Mike Hearn
2013-03-07 17:38:13 +01:00
parent 0534231de9
commit c8c1e68152
3 changed files with 183 additions and 130 deletions

View File

@@ -120,6 +120,7 @@ public class PingService {
": " + tx);
tx.getConfidence().addEventListener(new TransactionConfidence.Listener() {
public void onConfidenceChanged(Transaction tx2) {
// Must be thread safe.
if (tx2.getConfidence().getConfidenceType() == TransactionConfidence.ConfidenceType.BUILDING) {
// Coins were confirmed (appeared in a block).
tx2.getConfidence().removeEventListener(this);