@ Override protected void disconnectTransactions ( StoredBlock oldBlock ) throws PrunedException , BlockStoreException { checkState ( lock . isHeldByCurrentThread ( ) ) ; blockStore . beginDatabaseBatchWrite ( ) ; try { StoredUndoableBlock undoBlock = blockStore . getUndoBlock ( oldBlock . getHeader ( ) . getHash ( ) ) ; if ( undoBlock == null ) throw new PrunedException ( oldBlock . getHeader ( ) . getHash ( ) ) ; TransactionOutputChanges txOutChanges = undoBlock . getTxOutChanges ( ) ; for ( UTXO out : txOutChanges . txOutsSpent ) blockStore . addUnspentTransactionOutput ( out ) ; for ( UTXO out : txOutChanges . txOutsCreated ) blockStore . removeUnspentTransactionOutput ( out ) ; } catch ( PrunedException e ) { blockStore . abortDatabaseBatchWrite ( ) ; throw e ; } catch ( BlockStoreException e ) { blockStore . abortDatabaseBatchWrite ( ) ; throw e ; } }
This is broken for blocks that do not pass BIP30 so all BIP30 - failing blocks which are allowed to fail BIP30 must be checkpointed .