diff --git a/SHiNE-server/shine-server-archive/src/main/java/server/archive/ArweaveBlockSyncService.java b/SHiNE-server/shine-server-archive/src/main/java/server/archive/ArweaveBlockSyncService.java index 18d2ca75..786f85b1 100644 --- a/SHiNE-server/shine-server-archive/src/main/java/server/archive/ArweaveBlockSyncService.java +++ b/SHiNE-server/shine-server-archive/src/main/java/server/archive/ArweaveBlockSyncService.java @@ -88,8 +88,8 @@ public final class ArweaveBlockSyncService { if (blocksDAO.existsByDataItemId(id32) || importDAO.exists(id32)) continue; try { - byte[] rawDataItem = downloadSignedDataItem(dataItemId); - if (importDAO.enqueueIfMissing(id32, height, rawDataItem, System.currentTimeMillis())) discovered++; + DownloadedDataItem downloaded = downloadSignedDataItem(dataItemId); + if (importDAO.enqueueIfMissing(id32, downloaded.rootTxId(), height, downloaded.rawDataItem(), System.currentTimeMillis())) discovered++; } catch (Exception e) { lowestRetryHeight = Math.min(lowestRetryHeight, height); log.warn("Cannot retrieve signed DataItem {} at height {} yet: {}", dataItemId, height, e.getMessage()); @@ -184,7 +184,7 @@ public final class ArweaveBlockSyncService { * Gateways normally expose only the payload at /{dataItemId}. SHiNE needs the complete signed * DataItem, so obtain its exact offset/size inside the root L1 transaction and range-read it. */ - private byte[] downloadSignedDataItem(String dataItemId) throws Exception { + private DownloadedDataItem downloadSignedDataItem(String dataItemId) throws Exception { JsonNode offsets = getOffsets(dataItemId); String rootTxId = offsets.path("rootTxId").asText("").trim(); long rootOffset = offsets.path("rootOffset").asLong(-1L); @@ -215,10 +215,12 @@ public final class ArweaveBlockSyncService { if (!Arrays.equals(parsed.id32(), expectedId)) { throw new IOException("Range returned another ANS-104 DataItem for " + dataItemId); } - return bytes; + return new DownloadedDataItem(rootTxId, bytes); } } + private record DownloadedDataItem(String rootTxId, byte[] rawDataItem) {} + private JsonNode getOffsets(String dataItemId) throws Exception { HttpRequest req = HttpRequest.newBuilder(URI.create(trim(cfg.syncGateway()) + "/ar-io/offsets/" + dataItemId)) .timeout(Duration.ofSeconds(30)).header("Accept","application/json").GET().build(); diff --git a/SHiNE-server/shine-server-db/src/main/java/shine/db/dao/ArweaveBlockImportDAO.java b/SHiNE-server/shine-server-db/src/main/java/shine/db/dao/ArweaveBlockImportDAO.java index 74b8174e..e51f980d 100644 --- a/SHiNE-server/shine-server-db/src/main/java/shine/db/dao/ArweaveBlockImportDAO.java +++ b/SHiNE-server/shine-server-db/src/main/java/shine/db/dao/ArweaveBlockImportDAO.java @@ -51,21 +51,22 @@ public final class ArweaveBlockImportDAO { } /** Insert once. Existing IDs (including REJECTED) are deliberately not re-enqueued. */ - public boolean enqueueIfMissing(byte[] dataItemId, long blockHeight, byte[] rawDataItem, long nowMs) + public boolean enqueueIfMissing(byte[] dataItemId, String rootTxId, long blockHeight, byte[] rawDataItem, long nowMs) throws SQLException { String sql = """ INSERT INTO arweave_block_import_queue( - data_item_id,block_height,raw_data_item,status,last_error,first_seen_at_ms,updated_at_ms - ) VALUES(?,?,?,?, '',?,?) + data_item_id,root_tx_id,block_height,raw_data_item,status,last_error,first_seen_at_ms,updated_at_ms + ) VALUES(?,?,?,?,?, '',?,?) ON CONFLICT(data_item_id) DO NOTHING """; try (Connection c = db.getConnection(); PreparedStatement ps = c.prepareStatement(sql)) { ps.setBytes(1, dataItemId); - ps.setLong(2, blockHeight); - ps.setBytes(3, rawDataItem); - ps.setString(4, STATUS_PENDING); - ps.setLong(5, nowMs); + ps.setString(2, rootTxId == null ? "" : rootTxId.trim()); + ps.setLong(3, blockHeight); + ps.setBytes(4, rawDataItem); + ps.setString(5, STATUS_PENDING); ps.setLong(6, nowMs); + ps.setLong(7, nowMs); return ps.executeUpdate() > 0; } } diff --git a/SHiNE-server/src/main/java/server/sync/PeriodicBlockchainSyncService.java b/SHiNE-server/src/main/java/server/sync/PeriodicBlockchainSyncService.java index 9fdc7d15..d4567e7a 100644 --- a/SHiNE-server/src/main/java/server/sync/PeriodicBlockchainSyncService.java +++ b/SHiNE-server/src/main/java/server/sync/PeriodicBlockchainSyncService.java @@ -228,11 +228,11 @@ public final class PeriodicBlockchainSyncService { try { BlockchainResyncCleanupDAO.CleanupResult cleanup = RESYNC_CLEANUP_DAO.cleanupBlockchainForFullResync(blockchainName); - log.info("Blockchain resync cleanup finished: blockchainName={} login={} likesAdjusted={} repliesAdjusted={} deletedBlocks={} deletedState={}", + log.info("Blockchain resync cleanup finished: blockchainName={} login={} deletedReactionsState={} deletedConnectionsState={} deletedBlocks={} deletedState={}", blockchainName, cleanup.login(), - cleanup.likesAdjustedRows(), - cleanup.repliesAdjustedRows(), + cleanup.deletedReactionsStateRows(), + cleanup.deletedConnectionsStateRows(), cleanup.deletedBlocksRows(), cleanup.deletedBlockchainStateRows()); diff --git a/VERSION.properties b/VERSION.properties index 2e93e711..0fdf55d3 100644 --- a/VERSION.properties +++ b/VERSION.properties @@ -1,2 +1,2 @@ -client.version=1.14.6 -server.version=1.12.4 +client.version=1.14.7 +server.version=1.12.5 diff --git a/shine-UI/js/services/solana-wallet-service.js b/shine-UI/js/services/solana-wallet-service.js index a195675b..b6e15c21 100644 --- a/shine-UI/js/services/solana-wallet-service.js +++ b/shine-UI/js/services/solana-wallet-service.js @@ -161,7 +161,7 @@ export async function createSolanaWalletFromPrivateBase58(privateKey32Base58) { }; } -) { +export async function getWalletFromStoredClientKey({ login, storagePwd }) { const cleanLogin = String(login || '').trim(); const cleanPwd = String(storagePwd || '').trim(); if (!cleanLogin || !cleanPwd) { @@ -200,7 +200,7 @@ export async function getWalletFromStoredBlockchainKey({ login, storagePwd }) { }; } -) { +export async function getWalletFromStoredRootKey({ login, storagePwd }) { const cleanLogin = String(login || '').trim(); const cleanPwd = String(storagePwd || '').trim(); if (!cleanLogin || !cleanPwd) {