Two dead-code removals surfaced by the audit; no runtime behavior change.
1. Delete the lite-lifecycle "readiness" scaffold (~1,586 lines). The pure
dry-run evaluateLiteWalletServerLifecycleReadiness (whose own status text
says "wallet lifecycle execution is still disabled in this scaffold") had
zero callers; executeLiteWalletServerSelectionUi had zero callers; and
executeLiteWalletLifecycleUiRequest's only caller was a fallback in
settings_page reached only when app->liteWallet() is null. Deleted
lite_wallet_server_lifecycle_readiness.{h,cpp} and the readiness /
UI-execution machinery + enums + translation tables from both adapters,
keeping the genuinely-live helpers (liteConnectionSettingsFromAppSettings,
applyLiteConnectionSettingsToAppSettings, redactLiteServerSelectionValue,
and the LiteWalletLifecycleUiExecutionInput DTO the live create/open/
restore path still uses). The null-backend fallback now sets a plain
"Lite wallet backend unavailable" status. This is exactly the
readiness/scaffold pattern CLAUDE.md forbids regrowing.
2. Split the HushChat fixture/capture-manifest/seed-projection tooling
(~2,050 lines, incl. the libsodium seed-projection) out of
chat_protocol.cpp (1854 -> 284) and chat_protocol.h (586 -> 105) into a
new chat_fixture_tooling.{h,cpp} compiled ONLY into the HushChatFixtureCheck
dev tool — never into the app, lite, or test binaries (verified via nm).
The app keeps only the runtime slice (memo parsing + tx metadata
extraction) that network_refresh_service actually calls. Also moved the
decrypt-preflight/hex helpers, which likewise had no runtime caller.
Note: the HushChat split is on gated-off experimental code and should be
coordinated with the pending dormant-HushChat-content handling (commit
af06b8b) before the lite PR — done here as a pure mechanical split, no redesign.
Full-node + Lite + HushChatFixtureCheck build clean; ctest 1/1; hygiene clean.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
106 lines
2.7 KiB
C++
106 lines
2.7 KiB
C++
#pragma once
|
|
|
|
#include <cstddef>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#ifndef DRAGONX_ENABLE_CHAT
|
|
#define DRAGONX_ENABLE_CHAT 0
|
|
#endif
|
|
|
|
namespace dragonx::chat {
|
|
|
|
enum class HushChatHeaderType {
|
|
Message,
|
|
ContactRequest
|
|
};
|
|
|
|
struct HushChatHeader {
|
|
int header_number = 0;
|
|
int version = 0;
|
|
std::string reply_zaddr;
|
|
std::string conversation_id;
|
|
HushChatHeaderType type = HushChatHeaderType::Message;
|
|
std::string secretstream_header_hex;
|
|
std::string public_key_hex;
|
|
};
|
|
|
|
struct HushChatHeaderParseResult {
|
|
bool ok = false;
|
|
HushChatHeader header;
|
|
std::string error;
|
|
};
|
|
|
|
struct HushChatMemoOutput {
|
|
std::size_t position = 0;
|
|
std::string memo;
|
|
};
|
|
|
|
struct HushChatMemoPair {
|
|
HushChatHeader header;
|
|
std::size_t header_position = 0;
|
|
std::size_t payload_position = 0;
|
|
std::string payload_memo;
|
|
};
|
|
|
|
enum class HushChatMemoGroupingIssue {
|
|
InvalidHeader,
|
|
MissingPayload,
|
|
DuplicateHeader,
|
|
OversizedMemo
|
|
};
|
|
|
|
struct HushChatMemoGroupingIssueInfo {
|
|
HushChatMemoGroupingIssue issue = HushChatMemoGroupingIssue::InvalidHeader;
|
|
std::size_t position = 0;
|
|
std::string detail;
|
|
};
|
|
|
|
struct HushChatMemoGroupingResult {
|
|
std::vector<HushChatMemoPair> pairs;
|
|
std::vector<HushChatMemoGroupingIssueInfo> issues;
|
|
std::size_t ignored_memo_count = 0;
|
|
};
|
|
|
|
struct HushChatTransactionInput {
|
|
std::string txid;
|
|
std::vector<HushChatMemoOutput> outputs;
|
|
};
|
|
|
|
struct HushChatTransactionMetadata {
|
|
std::string txid;
|
|
HushChatHeaderType type = HushChatHeaderType::Message;
|
|
std::string conversation_id;
|
|
std::string reply_zaddr;
|
|
std::size_t header_position = 0;
|
|
std::size_t payload_position = 0;
|
|
std::size_t payload_size = 0;
|
|
};
|
|
|
|
struct HushChatTransactionExtractionResult {
|
|
bool feature_enabled = false;
|
|
std::vector<HushChatTransactionMetadata> metadata;
|
|
std::vector<HushChatMemoGroupingIssueInfo> issues;
|
|
std::size_t ignored_memo_count = 0;
|
|
};
|
|
|
|
constexpr int kHushChatSupportedVersion = 0;
|
|
constexpr std::size_t kHushChatMemoByteLimit = 512;
|
|
constexpr std::size_t kHushChatPublicKeyHexLength = 64;
|
|
constexpr std::size_t kHushChatSecretstreamHeaderHexLength = 48;
|
|
|
|
constexpr bool hushChatFeatureEnabledAtBuild()
|
|
{
|
|
return DRAGONX_ENABLE_CHAT != 0;
|
|
}
|
|
|
|
HushChatHeaderParseResult parseHushChatHeaderMemo(const std::string& memo);
|
|
HushChatMemoGroupingResult groupHushChatMemoOutputs(const std::vector<HushChatMemoOutput>& outputs);
|
|
HushChatTransactionExtractionResult extractHushChatTransactionMetadata(
|
|
const HushChatTransactionInput& transaction,
|
|
bool featureEnabled = hushChatFeatureEnabledAtBuild());
|
|
const char* hushChatHeaderTypeName(HushChatHeaderType type);
|
|
const char* hushChatMemoGroupingIssueName(HushChatMemoGroupingIssue issue);
|
|
|
|
} // namespace dragonx::chat
|