-
Notifications
You must be signed in to change notification settings - Fork 0
Code Cleanup Analysis
This document identifies redundant, deprecated, and unused code in the O Blockchain codebase.
The following deprecated commands have been removed (no production deployment yet):
-
submitwaterpriceβ Usesubmitwaterpricetx(blockchain-based) -
validatemeasurementβ Usesubmitvalidationtx(blockchain-based) -
submitexchangerateβ Usesubmitexchangeratetx(blockchain-based)
Result: Removed ~170 lines of deprecated code. All measurement commands now use blockchain transactions.
In src/rpc/register.h (lines 37-39, 68-70):
// void RegisterOCurrencyLifecycleRPCCommands(CRPCTable &tableRPC); // Temporarily disabled
// void RegisterOBrightIDRPCCommands(CRPCTable &tableRPC); // Temporarily disabled
// void RegisterOBlockchainRPCCommands(CRPCTable &tableRPC);Issues:
-
RegisterOBlockchainRPCCommandsmight includeregisterusercommand (which we saw was missing) - These are "temporarily disabled" but unclear why or when they'll be re-enabled
- Recommendation: Document why they're disabled or remove if not needed
- Status: Has TODO comment: "TODO: Implement full wallet integration"
- Current behavior: Creates transaction structure but doesn't add inputs/funding
- Impact: Transactions can't be broadcast (need manual funding)
- Recommendation: Complete implementation or document that manual funding is required
In src/rpc/o_blockchain_tx_rpc.cpp:
-
#include <wallet/coinselection.h>- May not be used (leftover from incomplete funding implementation) -
#include <rpc/server_util.h>- May not be used -
#include <node/context.h>- May not be used
Recommendation: Remove if not actually used after checking.
- Status: Deprecated, returns null hash, logs warning
-
Replacement: Use
submitwaterpricetxorsubmitexchangeratetxRPC commands - Recommendation: Remove or document as deprecated API
-
Old RAM-based measurement functions removed: The code comments indicate
SubmitWaterPrice()andValidateWaterPrice()were removed (seesrc/measurement/measurement_system.cpp:67-70) - Clear deprecation messages: Deprecated commands provide clear error messages directing users to new commands
-
Complete
CreateAndBroadcastOTransaction: Either implement full wallet funding or document that manual funding is required -
Remove unused includes: Check and remove
wallet/coinselection.h,rpc/server_util.h,node/context.hif not used -
Document commented registrations: Add comments explaining why
RegisterOBlockchainRPCCommandsis disabled
- β
Remove deprecated RPC commands: DONE - Removed
submitwaterprice,validatemeasurement, andsubmitexchangerate -
Remove deprecated functions: Remove
SubmitMeasurementWithValidationfunctions or mark as deprecated in header
- Review TODOs: Address or document all TODO comments
- Clean up commented code: Remove or document why code is commented out
- Deprecated commands: β Removed (0)
- Commented out registrations: 3 RPC command groups
-
Incomplete implementations: 1 function (
CreateAndBroadcastOTransaction) - Unused includes: β Cleaned up
- TODOs: Multiple throughout codebase
The codebase is generally clean, but has some technical debt:
- Deprecated commands are kept for backward compatibility (good practice)
- Some incomplete implementations need completion or documentation
- A few potentially unused includes should be verified and removed
- Commented-out code should be documented or removed
Overall code quality: Good - Most issues are intentional (backward compatibility) or minor (incomplete features).
Β© O International
A Nonprofit Association Focused on the Creation of a Water Price-Based Stable Coin
Association de Loi 1901 β France NumΓ©ro de Siret (French SIREN): 924 014 467 00014