Дорабатываю добавление блоков! Вроде всё.Осталось ещё размер уточнить что без хэш и пподписи  2
This commit is contained in:
AidarKC
2025-12-23 16:12:36 +03:00
parent 9633e3528d
commit 26afcb892a
7 changed files with 118 additions and 492 deletions
@@ -1,7 +1,7 @@
package server.logic.ws_protocol.JSON.handlers.blockchain;
import blockchain_new.BchBlockEntry_new;
import blockchain_new.BchCryptoVerifier_new;
import blockchain.BchBlockEntry;
import blockchain.BchCryptoVerifier;
import server.logic.ws_protocol.WireCodes;
import shine.db.SqliteDbController;
import shine.db.dao.BlockchainStateDAO;
@@ -102,9 +102,9 @@ public final class BlockchainStateService_new {
return new AddBlockResult(WireCodes.Status.BAD_REQUEST, "bad_block_base64", 0, "");
}
final BchBlockEntry_new block;
final BchBlockEntry block;
try {
block = new BchBlockEntry_new(blockBytes);
block = new BchBlockEntry(blockBytes);
} catch (Exception e) {
return new AddBlockResult(WireCodes.Status.BAD_REQUEST, "bad_block_format", 0, "");
}
@@ -158,7 +158,7 @@ public final class BlockchainStateService_new {
byte[] prevLineHash32 = prevGlobalHash32; // пока линии не используем
// 5) крипто-проверка
boolean ok = BchCryptoVerifier_new.verifyAll(
boolean ok = BchCryptoVerifier.verifyAll(
login,
prevGlobalHash32,
prevLineHash32,
@@ -35,9 +35,7 @@ public final class Net_AddBlock_new_Handler implements JsonMessageHandler {
}
// Даже при ошибке (например bad_global_sequence) можно вернуть “что сервер считает последним”
if (r.serverLastGlobalNumber != null) {
resp.setServerLastGlobalNumber(r.serverLastGlobalNumber);
}
resp.setServerLastGlobalNumber(r.serverLastGlobalNumber);
if (r.serverLastGlobalHash != null) {
resp.setServerLastGlobalHash(r.serverLastGlobalHash);
}