HomePhabricator

fix ubsan for rpc method calling

Description

fix ubsan for rpc method calling

Summary:
Fixes UndefinedBehaviorSanitizer (ubsan) check

WIP: Because if awful as hell.

Original error:

../../src/test/rpc_tests.cpp:32:27: runtime error: call to function getexcessiveblock(Config const&, JSONRPCRequest const&) through pointer to incorrect function type 'UniValue (*)(Config &, const JSONRPCRequest &)'

when running: ../configure --enable-ubsan && make && ./src/test/test_bitcoin

(this error general name is: "Indirect call of a function through a function pointer of the wrong type", and it is only reported on Darwin/Linux, C++ and x86/x86_64 only, according: https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html).

Test Plan:
../configure --enable-ubsan && make && ./src/test/test_bitcoin
no error should appear

Reviewers: deadalnix, #bitcoin_abc

Reviewed By: deadalnix, #bitcoin_abc

Subscribers: teamcity

Differential Revision: https://reviews.bitcoinabc.org/D1371