ESP32: NTP для update user_pda
This commit is contained in:
parent
4b94303d67
commit
7d9db68d80
@ -3254,6 +3254,16 @@ static bool updateHomeserverSessionOnSolana(bool requireExisting, String &messag
|
|||||||
}
|
}
|
||||||
saveRegisterDiagCheckpoint("Local keys restored", diagDetails);
|
saveRegisterDiagCheckpoint("Local keys restored", diagDetails);
|
||||||
|
|
||||||
|
if (!ensureNtpTimeSynced(messageOut)) {
|
||||||
|
diagDetails += String("ntp_error=") + messageOut + "\n";
|
||||||
|
return failWithDiag(messageOut);
|
||||||
|
}
|
||||||
|
uint64_t updatedAtMs = 0;
|
||||||
|
if (!getSystemEpochMs(updatedAtMs)) {
|
||||||
|
return failWithDiag("NTP time is not ready");
|
||||||
|
}
|
||||||
|
diagDetails += String("updated_at_ms=") + String((unsigned long long)updatedAtMs) + "\n";
|
||||||
|
|
||||||
uint8_t userPda[32] = {};
|
uint8_t userPda[32] = {};
|
||||||
uint8_t economyConfig[32] = {};
|
uint8_t economyConfig[32] = {};
|
||||||
uint8_t inflowVault[32] = {};
|
uint8_t inflowVault[32] = {};
|
||||||
@ -3279,7 +3289,7 @@ static bool updateHomeserverSessionOnSolana(bool requireExisting, String &messag
|
|||||||
memcpy(nextState.recoveryKey32, recoveryPub, 32);
|
memcpy(nextState.recoveryKey32, recoveryPub, 32);
|
||||||
memcpy(nextState.rootKey32, rootPub, 32);
|
memcpy(nextState.rootKey32, rootPub, 32);
|
||||||
memcpy(nextState.clientKey32, clientPub, 32);
|
memcpy(nextState.clientKey32, clientPub, 32);
|
||||||
nextState.updatedAtMs = shineNowMs();
|
nextState.updatedAtMs = updatedAtMs;
|
||||||
nextState.recordNumber = currentState.recordNumber + 1;
|
nextState.recordNumber = currentState.recordNumber + 1;
|
||||||
if (nextState.sessionsMode == 0) {
|
if (nextState.sessionsMode == 0) {
|
||||||
nextState.sessionsMode = 1;
|
nextState.sessionsMode = 1;
|
||||||
|
|||||||
@ -70,7 +70,7 @@
|
|||||||
- флаги:
|
- флаги:
|
||||||
`wifiReady`, `serversReady`, `secretReady`, `registered`, `online`.
|
`wifiReady`, `serversReady`, `secretReady`, `registered`, `online`.
|
||||||
|
|
||||||
Для первой регистрации обычного `user PDA` устройство берёт `createdAtMs` / `updatedAtMs` из NTP прямо перед отправкой транзакции в Solana. Дальше в `user PDA` сохраняется `accessServers`, где по умолчанию лежит `shineupme`.
|
Для первой регистрации обычного `user PDA` устройство берёт `createdAtMs` из NTP прямо перед отправкой транзакции в Solana. При последующих обновлениях `user PDA` устройство так же берёт актуальный `updatedAtMs` из NTP перед отправкой update-транзакции. Дальше в `user PDA` сохраняется `accessServers`, где по умолчанию лежит `shineupme`.
|
||||||
|
|
||||||
## Правило серверной сессии SHiNE
|
## Правило серверной сессии SHiNE
|
||||||
|
|
||||||
|
|||||||
@ -1,2 +1,2 @@
|
|||||||
client.version=1.2.246
|
client.version=1.2.247
|
||||||
server.version=1.2.231
|
server.version=1.2.232
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user