diff --git a/burst_1.2.4/.gitignore b/burst_1.2.4/.gitignore deleted file mode 100644 index ea358d8..0000000 --- a/burst_1.2.4/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -burst.jar -burst_test_db -burst_db -nxt.log -nxt.log.lck - diff --git a/burst_1.2.4/Burst_Wallet.exe b/burst_1.2.4/Burst_Wallet.exe index 77ade36..239f3fc 100644 Binary files a/burst_1.2.4/Burst_Wallet.exe and b/burst_1.2.4/Burst_Wallet.exe differ diff --git a/burst_1.2.4/burst.jar b/burst_1.2.4/burst.jar new file mode 100644 index 0000000..f086402 Binary files /dev/null and b/burst_1.2.4/burst.jar differ diff --git a/burst_1.2.4/src/java/nxt/BlockchainProcessorImpl.java b/burst_1.2.4/src/java/nxt/BlockchainProcessorImpl.java index 4ae7a89..7a1287c 100644 --- a/burst_1.2.4/src/java/nxt/BlockchainProcessorImpl.java +++ b/burst_1.2.4/src/java/nxt/BlockchainProcessorImpl.java @@ -317,6 +317,10 @@ public void run() { } long currentBlockId = (lastDownloaded == 0 ? commonBlockId : lastDownloaded); + if(commonBlock.getHeight() < blockchain.getLastBlock().getHeight()) { // fork point + currentBlockId = commonBlockId; + } + List forkBlocks = new ArrayList<>(); boolean processedAll = true; @@ -986,7 +990,35 @@ private BlockImpl popLastBlock() { for (TransactionImpl transaction : block.getTransactions()) { transaction.unsetBlock(); } + Logger.logErrorMessage("popping a block: " + block.getId()); + long headTx = 0; + if(block.getTransactions().size() > 0) { + headTx = block.getTransactions().get(0).getId(); + Logger.logErrorMessage("head tx:" + headTx); + } + if(headTx != 0 && TransactionDb.hasTransaction(headTx)) { + Logger.logErrorMessage("before pop has tx"); + } BlockDb.deleteBlocksFrom(block.getId()); + if(headTx != 0 && TransactionDb.hasTransaction(headTx)) { + Logger.logErrorMessage("after pop has tx"); + try(Connection con = Db.getConnection(); + PreparedStatement pstmt = con.prepareStatement("DELETE FROM TRANSACTION WHERE block_id = ?")) { + pstmt.setLong(1, block.getId()); + pstmt.executeUpdate(); + } catch (SQLException e) { + Logger.logErrorMessage("failed delete", e); + } + if(TransactionDb.hasTransaction(headTx)) { + Logger.logErrorMessage("still has tx after delete attempt"); + } + else { + Logger.logErrorMessage("tx was successfully deleted"); + } + } + else { + Logger.logErrorMessage("after pop not have tx"); + } blockListeners.notify(block, Event.BLOCK_POPPED); return previousBlock; } diff --git a/readme.txt b/readme.txt index 829ee56..f06fb81 100644 --- a/readme.txt +++ b/readme.txt @@ -19,7 +19,9 @@ _____ Changelog: +0.3.1 ++Hotfix for stucked local wallet. 0.3