Skip to content

build: add ENABLE_WALLET guards to rpc/rpcassets.cpp#446

Open
JSanchezFDZ wants to merge 1 commit into
Raptor3um:developfrom
JSanchezFDZ:fix/disable-wallet-build-rpcassets
Open

build: add ENABLE_WALLET guards to rpc/rpcassets.cpp#446
JSanchezFDZ wants to merge 1 commit into
Raptor3um:developfrom
JSanchezFDZ:fix/disable-wallet-build-rpcassets

Conversation

@JSanchezFDZ

Copy link
Copy Markdown

Summary

Restore the ability to build with ./configure --disable-wallet on current develop.

PR #436 (Bug/createrawtransaction for asset) added three new RPC handlers in src/rpc/rpcassets.cpp that unconditionally reference wallet-only symbols (CWallet, GetWalletForJSONRPCRequest, COutput, CCoinControl, CInputCoin, CoinType):

  • listassetsbalance (lines 815-869)
  • listunspentassets (lines 871-1064)
  • listassets, mine=true branch (lines 1160-1203)

The RPC command table at the bottom of the file already wraps the registrations for listassetsbalance and listunspentassets in #ifdef ENABLE_WALLET, but the function bodies themselves were left unguarded. Since the file's includes for wallet headers are gated on ENABLE_WALLET (lines 16-20), --disable-wallet builds fail to compile this TU with dozens of "CWallet was not declared in this scope" errors.

Fix

  • Wrap the two wallet-only function bodies (listassetsbalance, listunspentassets) in #ifdef ENABLE_WALLET / #endif. The matching table entries are already guarded, so when the bodies are absent the function pointers are simply never referenced.
  • In listassets, the function is intentionally mixed: mine=false is wallet-independent (queries passetsdb only), mine=true needs the wallet. Guard only the mine=true branch, and in the #else path throw RPC_METHOD_NOT_FOUND so a client that requests mine=true against a no-wallet node sees a clear error instead of silently getting wrong data.

Test plan

  • ./configure --disable-bench --without-gui --disable-wallet, then make rpc/libraptoreum_server_a-rpcassets.o — compiles cleanly (was broken on develop).
  • nm on the resulting .o confirms zero unresolved CWallet / GetWalletForJSONRPCRequest symbols.
  • ./configure ... --enable-wallet --with-incompatible-bdb, then recompile the same TU — still builds.

Note: a separate, pre-existing link-time failure in src/mapport.cpp (undefined references to readnatpmpresponseorretry / sendnewportmappingrequest from libnatpmp) keeps the no-wallet raptoreumd link from completing on this build host. That's an unrelated NAT-PMP library-ordering issue and not in scope here.

Why this matters

  • CI builds with --disable-wallet (e.g. for testing headless/light-node configurations) are currently broken on develop.
  • Future Guix-style deterministic builds typically need both --enable-wallet and --disable-wallet paths to work.

Related: #443 (EVM integration, runs into this same restriction during test-suite verification), #444 (the amount_tests overflow fix that lets the test suite report honest pass/fail counts), #445 (broader CFeeRate hardening tracking).

PR Raptor3um#436 added three new RPC handlers that unconditionally reference
wallet-only symbols (CWallet, GetWalletForJSONRPCRequest, COutput,
CCoinControl, CInputCoin, CoinType):

  * listassetsbalance        (lines 815-869)
  * listunspentassets        (lines 871-1064)
  * listassets, mine=true    (lines 1160-1203)

The RPC command table at the bottom of the file already wraps
the registrations for listassetsbalance and listunspentassets in
#ifdef ENABLE_WALLET, but the function bodies themselves were left
unguarded. As a result, configure --disable-wallet builds fail to
compile rpc/rpcassets.cpp with dozens of "CWallet was not declared
in this scope" errors.

Wrap the two wallet-only function bodies in #ifdef ENABLE_WALLET, and
in listassets() guard only the mine=true branch (the mine=false branch
is intentionally wallet-independent). When wallet support is compiled
out and a client passes mine=true, return a clear
RPC_METHOD_NOT_FOUND error rather than silently producing wrong data.

Verified locally on develop HEAD (989ec2e):

  ./configure --disable-wallet ...   builds raptoreumd successfully
                                     (modulo an unrelated NAT-PMP link
                                     issue in src/mapport.cpp that
                                     predates this change)
  ./configure --enable-wallet ...    still builds, RPCs still work
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant