Page MenuHomePhabricator

[refactoring] eliminate Boost::Optional for std::optional
ClosedPublic

Authored by majcosta on Nov 21 2020, 13:07.

Details

Summary
find ./src -type f \( -iname \*.h -o -iname \*.cpp \) -exec sed -i 's/Optional</std::optional</g' {} \;
find ./src -type f \( -iname \*.h -o -iname \*.cpp \) -exec sed -i 's/nullopt/std::nullopt/g' {} \;
find ./src -type f \( -iname \*.h -o -iname \*.cpp \) -exec sed -i 's/#include <optional.h>//g' {} \;
rm ./src/optional.h

a few changes apart from the scripts above were necessary:

1- on psbt.cpp a use of Boost::Optional::get_ptr() (doesn't exist in std::optional) was replaced with a slightly more cumbersome construct to preserve behavior (either pass a pointer to the value if initialized or nullptr)

2- in both wallet/rpcwallet.cpp and wallet/wallet.cpp a funky conditional initialization via Boost::MakeOptional was used to workaround gcc bug #47679. I've removed that, thinking it unlikely that bug exists for std::optional

3- in bench/wallet_balance.cpp a call to Boost::Optional::get_value_or is replaced with std::optional::value_or


Depends on D8493

Test Plan
ninja all check check-functional

Diff Detail

Event Timeline

messed up my script, gonna fix those newlines in place of #include <optional.h>

Tail of the build log:

[185/492] Building CXX object src/CMakeFiles/server.dir/avalanche/proofbuilder.cpp.o
[186/492] Building CXX object src/CMakeFiles/server.dir/blockfilter.cpp.o
[187/492] Building CXX object src/CMakeFiles/server.dir/banman.cpp.o
[188/492] Building CXX object src/CMakeFiles/server.dir/consensus/activation.cpp.o
[189/492] Building CXX object src/CMakeFiles/server.dir/checkpoints.cpp.o
[190/492] Building CXX object src/CMakeFiles/server.dir/addrman.cpp.o
[191/492] Building CXX object src/CMakeFiles/server.dir/consensus/tx_verify.cpp.o
[192/492] Building CXX object src/CMakeFiles/server.dir/addrdb.cpp.o
[193/492] Building CXX object src/CMakeFiles/server.dir/flatfile.cpp.o
[194/492] Building CXX object src/CMakeFiles/server.dir/avalanche/peermanager.cpp.o
[195/492] Building CXX object src/CMakeFiles/server.dir/dbwrapper.cpp.o
[196/492] Building CXX object src/CMakeFiles/server.dir/blockencodings.cpp.o
[197/492] Building CXX object src/CMakeFiles/server.dir/httpserver.cpp.o
[198/492] Building CXX object src/CMakeFiles/server.dir/avalanche/processor.cpp.o
[199/492] Building CXX object src/CMakeFiles/server.dir/httprpc.cpp.o
[200/492] Building CXX object src/CMakeFiles/server.dir/index/base.cpp.o
[201/492] Building CXX object src/CMakeFiles/server.dir/interfaces/chain.cpp.o
FAILED: src/CMakeFiles/server.dir/interfaces/chain.cpp.o 
/usr/bin/ccache /usr/bin/clang++  -DBOOST_AC_USE_STD_ATOMIC -DBOOST_SP_USE_STD_ATOMIC -DBUILD_BITCOIN_INTERNAL -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/leveldb/helpers/memenv -I../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -g -O2 -fPIC -fvisibility=hidden   -fstack-protector-all -Wstack-protector -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wthread-safety -Wshadow -Wshadow-field -Wrange-loop-analysis -Wredundant-decls -Wformat-security -Wredundant-move -Wno-unused-parameter -Wno-implicit-fallthrough -pthread -std=gnu++17 -MD -MT src/CMakeFiles/server.dir/interfaces/chain.cpp.o -MF src/CMakeFiles/server.dir/interfaces/chain.cpp.o.d -o src/CMakeFiles/server.dir/interfaces/chain.cpp.o -c ../../src/interfaces/chain.cpp
In file included from ../../src/interfaces/chain.cpp:5:
../../src/./interfaces/chain.h:299:60: error: no template named 'function' in namespace 'std'
    virtual void rpcRunLater(const std::string &name, std::function<void()> fn,
                                                      ~~~~~^
../../src/interfaces/chain.cpp:432:43: error: non-virtual member function marked 'override' hides virtual member function
                         int64_t seconds) override {
                                          ^
../../src/./interfaces/chain.h:299:18: note: hidden overloaded virtual function 'interfaces::Chain::rpcRunLater' declared here: type mismatch at 2nd parameter ('int' vs 'std::function<void ()>')
    virtual void rpcRunLater(const std::string &name, std::function<void()> fn,
                 ^
In file included from ../../src/interfaces/chain.cpp:5:
In file included from ../../src/./interfaces/chain.h:8:
In file included from ../../src/./primitives/transaction.h:10:
In file included from ../../src/./amount.h:10:
In file included from ../../src/./serialize.h:20:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/memory:80:
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/unique_ptr.h:831:34: error: allocating an object of abstract class type 'interfaces::(anonymous namespace)::ChainImpl'
    { return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); }
                                 ^
../../src/interfaces/chain.cpp:450:17: note: in instantiation of function template specialization 'std::make_unique<interfaces::(anonymous namespace)::ChainImpl, NodeContext &, const CChainParams &>' requested here
    return std::make_unique<ChainImpl>(node, params);
                ^
../../src/./interfaces/chain.h:299:18: note: unimplemented pure virtual method 'rpcRunLater' in 'ChainImpl'
    virtual void rpcRunLater(const std::string &name, std::function<void()> fn,
                 ^
3 errors generated.
[202/492] Building CXX object src/CMakeFiles/server.dir/minerfund.cpp.o
[203/492] Building CXX object src/CMakeFiles/server.dir/index/blockfilterindex.cpp.o
[204/492] Building CXX object src/CMakeFiles/server.dir/index/txindex.cpp.o
[205/492] Building CXX object src/CMakeFiles/server.dir/node/context.cpp.o
[206/492] Building CXX object src/CMakeFiles/server.dir/node/coin.cpp.o
[207/492] Building CXX object src/CMakeFiles/server.dir/interfaces/node.cpp.o
[208/492] Building CXX object src/CMakeFiles/server.dir/node/psbt.cpp.o
[209/492] Building CXX object src/CMakeFiles/server.dir/node/coinstats.cpp.o
[210/492] Building CXX object src/CMakeFiles/server.dir/miner.cpp.o
[211/492] Building CXX object src/CMakeFiles/server.dir/net.cpp.o
[212/492] Building CXX object src/CMakeFiles/server.dir/init.cpp.o
[213/492] Building CXX object src/CMakeFiles/server.dir/validation.cpp.o
[214/492] Building CXX object src/CMakeFiles/server.dir/net_processing.cpp.o
ninja: build stopped: subcommand failed.
Build build-clang failed with exit code 1

Tail of the build log:

[171/490] Building C object src/secp256k1/CMakeFiles/secp256k1.dir/src/secp256k1.c.o
[172/490] Building C object src/secp256k1/CMakeFiles/ecmult-bench.dir/src/bench_ecmult.c.o
[173/490] Building C object src/secp256k1/CMakeFiles/internal-bench.dir/src/bench_internal.c.o
[174/490] Building CXX object src/CMakeFiles/server.dir/blockindex.cpp.o
[175/490] Building CXX object src/CMakeFiles/server.dir/config.cpp.o
[176/490] Building CXX object src/CMakeFiles/server.dir/avalanche/proof.cpp.o
[177/490] Building CXX object src/CMakeFiles/server.dir/avalanche/proofbuilder.cpp.o
[178/490] Building CXX object src/CMakeFiles/server.dir/blockfilter.cpp.o
[179/490] Building CXX object src/CMakeFiles/server.dir/chain.cpp.o
[180/490] Building CXX object src/CMakeFiles/server.dir/banman.cpp.o
[181/490] Building CXX object src/CMakeFiles/server.dir/addrman.cpp.o
[182/490] Building CXX object src/CMakeFiles/server.dir/addrdb.cpp.o
[183/490] Building CXX object src/CMakeFiles/server.dir/consensus/activation.cpp.o
[184/490] Building CXX object src/CMakeFiles/server.dir/consensus/tx_verify.cpp.o
[185/490] Building CXX object src/CMakeFiles/server.dir/flatfile.cpp.o
[186/490] Building CXX object src/CMakeFiles/server.dir/checkpoints.cpp.o
[187/490] Building CXX object src/CMakeFiles/server.dir/dbwrapper.cpp.o
[188/490] Building CXX object src/CMakeFiles/server.dir/blockencodings.cpp.o
[189/490] Building CXX object src/CMakeFiles/server.dir/avalanche/peermanager.cpp.o
[190/490] Building CXX object src/CMakeFiles/server.dir/interfaces/chain.cpp.o
FAILED: src/CMakeFiles/server.dir/interfaces/chain.cpp.o 
/usr/bin/cmake -E __run_co_compile --launcher=/usr/bin/ccache --tidy="/usr/bin/clang-tidy-8;-warnings-as-errors=*" --source=../../src/interfaces/chain.cpp -- /usr/bin/clang++  -DBOOST_AC_USE_STD_ATOMIC -DBOOST_SP_USE_STD_ATOMIC -DBUILD_BITCOIN_INTERNAL -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/leveldb/helpers/memenv -I../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -g -O2 -fPIC -fvisibility=hidden   -fstack-protector-all -Wstack-protector -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wthread-safety -Wshadow -Wshadow-field -Wrange-loop-analysis -Wredundant-decls -Wformat-security -Wredundant-move -Wno-unused-parameter -Wno-implicit-fallthrough -pthread -std=gnu++17 -MD -MT src/CMakeFiles/server.dir/interfaces/chain.cpp.o -MF src/CMakeFiles/server.dir/interfaces/chain.cpp.o.d -o src/CMakeFiles/server.dir/interfaces/chain.cpp.o -c ../../src/interfaces/chain.cpp
../../src/./interfaces/chain.h:299:60: error: no template named 'function' in namespace 'std' [clang-diagnostic-error]
    virtual void rpcRunLater(const std::string &name, std::function<void()> fn,
                                                           ^
/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/unique_ptr.h:831:34: error: allocating an object of abstract class type 'interfaces::(anonymous namespace)::ChainImpl' [clang-diagnostic-error]
    { return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); }
                                 ^
/work/abc-ci-builds/build-clang-tidy/../../src/interfaces/chain.cpp:450:17: note: in instantiation of function template specialization 'std::make_unique<interfaces::(anonymous namespace)::ChainImpl, NodeContext &, const CChainParams &>' requested here
    return std::make_unique<ChainImpl>(node, params);
                ^
../../src/./interfaces/chain.h:299:18: note: unimplemented pure virtual method 'rpcRunLater' in 'ChainImpl'
    virtual void rpcRunLater(const std::string &name, std::function<void()> fn,
                 ^
/work/abc-ci-builds/build-clang-tidy/../../src/interfaces/chain.cpp:432:43: error: non-virtual member function marked 'override' hides virtual member function [clang-diagnostic-error]
                         int64_t seconds) override {
                                          ^
../../src/./interfaces/chain.h:299:18: note: hidden overloaded virtual function 'interfaces::Chain::rpcRunLater' declared here: type mismatch at 2nd parameter ('int' vs 'std::function<void ()>')
    virtual void rpcRunLater(const std::string &name, std::function<void()> fn,
                 ^
3304 warnings and 3 errors generated.
Error while processing /work/abc-ci-builds/build-clang-tidy/../../src/interfaces/chain.cpp.
Suppressed 3304 warnings (3304 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
Found compiler error(s).
[191/490] Building CXX object src/CMakeFiles/server.dir/httpserver.cpp.o
[192/490] Building CXX object src/CMakeFiles/server.dir/avalanche/processor.cpp.o
[193/490] Building CXX object src/CMakeFiles/server.dir/index/base.cpp.o
[194/490] Building CXX object src/CMakeFiles/server.dir/httprpc.cpp.o
[195/490] Building CXX object src/CMakeFiles/server.dir/index/blockfilterindex.cpp.o
[196/490] Building CXX object src/CMakeFiles/server.dir/index/txindex.cpp.o
[197/490] Building CXX object src/CMakeFiles/server.dir/minerfund.cpp.o
[198/490] Building CXX object src/CMakeFiles/server.dir/interfaces/node.cpp.o
[199/490] Building CXX object src/CMakeFiles/server.dir/miner.cpp.o
[200/490] Building CXX object src/CMakeFiles/server.dir/net.cpp.o
[201/490] Building CXX object src/CMakeFiles/server.dir/validation.cpp.o
[202/490] Building CXX object src/CMakeFiles/server.dir/init.cpp.o
[203/490] Building CXX object src/CMakeFiles/server.dir/net_processing.cpp.o
ninja: build stopped: subcommand failed.
Build build-clang-tidy failed with exit code 1

Tail of the build log:

[214/492] Building CXX object src/CMakeFiles/server.dir/banman.cpp.o
[215/492] Building CXX object src/CMakeFiles/server.dir/addrdb.cpp.o
[216/492] Building CXX object src/CMakeFiles/server.dir/addrman.cpp.o
[217/492] Building CXX object src/CMakeFiles/server.dir/consensus/activation.cpp.o
[218/492] Building CXX object src/CMakeFiles/server.dir/consensus/tx_verify.cpp.o
[219/492] Building CXX object src/CMakeFiles/server.dir/dbwrapper.cpp.o
[220/492] Building CXX object src/CMakeFiles/server.dir/flatfile.cpp.o
[221/492] Building CXX object src/CMakeFiles/server.dir/avalanche/peermanager.cpp.o
[222/492] Building CXX object src/CMakeFiles/server.dir/checkpoints.cpp.o
[223/492] Building CXX object src/CMakeFiles/server.dir/blockencodings.cpp.o
[224/492] Building CXX object src/CMakeFiles/server.dir/httpserver.cpp.o
[225/492] Building CXX object src/CMakeFiles/server.dir/httprpc.cpp.o
[226/492] Building CXX object src/CMakeFiles/server.dir/avalanche/processor.cpp.o
[227/492] Building CXX object src/CMakeFiles/server.dir/index/base.cpp.o
[228/492] Building CXX object src/CMakeFiles/server.dir/interfaces/chain.cpp.o
FAILED: src/CMakeFiles/server.dir/interfaces/chain.cpp.o 
/usr/bin/ccache /usr/bin/c++  -DBOOST_AC_USE_STD_ATOMIC -DBOOST_SP_USE_STD_ATOMIC -DBUILD_BITCOIN_INTERNAL -DDEBUG -DDEBUG_LOCKORDER -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/leveldb/helpers/memenv -I../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -O0 -fPIC -fvisibility=hidden   -g3 -ftrapv -fstack-reuse=none -fstack-protector-all -Wstack-protector -U_FORTIFY_SOURCE -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wshadow -Wredundant-decls -Wformat-security -Wno-unused-parameter -Wno-implicit-fallthrough -pthread -std=gnu++17 -MD -MT src/CMakeFiles/server.dir/interfaces/chain.cpp.o -MF src/CMakeFiles/server.dir/interfaces/chain.cpp.o.d -o src/CMakeFiles/server.dir/interfaces/chain.cpp.o -c ../../src/interfaces/chain.cpp
In file included from ../../src/interfaces/chain.cpp:5:
../../src/./interfaces/chain.h:299:55: error: ‘std::function’ has not been declared
     virtual void rpcRunLater(const std::string &name, std::function<void()> fn,
                                                       ^~~
../../src/./interfaces/chain.h:299:68: error: expected ‘,’ or ‘...’ before ‘<’ token
     virtual void rpcRunLater(const std::string &name, std::function<void()> fn,
                                                                    ^
../../src/interfaces/chain.cpp:431:14: error: ‘void interfaces::{anonymous}::ChainImpl::rpcRunLater(const string&, std::function<void()>, int64_t)’ marked ‘override’, but does not override
         void rpcRunLater(const std::string &name, std::function<void()> fn,
              ^~~~~~~~~~~
In file included from /usr/include/c++/8/memory:80,
                 from ../../src/./serialize.h:20,
                 from ../../src/./amount.h:10,
                 from ../../src/./primitives/transaction.h:10,
                 from ../../src/./interfaces/chain.h:8,
                 from ../../src/interfaces/chain.cpp:5:
/usr/include/c++/8/bits/unique_ptr.h: In instantiation of ‘typename std::_MakeUniq<_Tp>::__single_object std::make_unique(_Args&& ...) [with _Tp = interfaces::{anonymous}::ChainImpl; _Args = {NodeContext&, const CChainParams&}; typename std::_MakeUniq<_Tp>::__single_object = std::unique_ptr<interfaces::{anonymous}::ChainImpl, std::default_delete<interfaces::{anonymous}::ChainImpl> >]’:
../../src/interfaces/chain.cpp:450:52:   required from here
/usr/include/c++/8/bits/unique_ptr.h:831:30: error: invalid new-expression of abstract class type ‘interfaces::{anonymous}::ChainImpl’
     { return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); }
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../src/interfaces/chain.cpp:165:11: note:   because the following virtual functions are pure within ‘interfaces::{anonymous}::ChainImpl’:
     class ChainImpl : public Chain {
           ^~~~~~~~~
In file included from ../../src/interfaces/chain.cpp:5:
../../src/./interfaces/chain.h:299:18: note: 	‘virtual void interfaces::Chain::rpcRunLater(const string&, int)’
     virtual void rpcRunLater(const std::string &name, std::function<void()> fn,
                  ^~~~~~~~~~~
[229/492] Building CXX object src/CMakeFiles/server.dir/index/blockfilterindex.cpp.o
[230/492] Building CXX object src/CMakeFiles/server.dir/index/txindex.cpp.o
[231/492] Building CXX object src/CMakeFiles/server.dir/minerfund.cpp.o
[232/492] Building CXX object src/CMakeFiles/server.dir/node/coin.cpp.o
[233/492] Building CXX object src/CMakeFiles/server.dir/node/context.cpp.o
[234/492] Building CXX object src/CMakeFiles/server.dir/node/psbt.cpp.o
[235/492] Building CXX object src/CMakeFiles/server.dir/interfaces/node.cpp.o
[236/492] Building CXX object src/CMakeFiles/server.dir/miner.cpp.o
[237/492] Building CXX object src/CMakeFiles/server.dir/net.cpp.o
[238/492] Building CXX object src/CMakeFiles/server.dir/node/coinstats.cpp.o
[239/492] Building CXX object src/CMakeFiles/server.dir/validation.cpp.o
[240/492] Building CXX object src/CMakeFiles/server.dir/init.cpp.o
[241/492] Building CXX object src/CMakeFiles/server.dir/net_processing.cpp.o
ninja: build stopped: subcommand failed.
Build build-debug failed with exit code 1

Tail of the build log:

[209/492] Building CXX object src/CMakeFiles/server.dir/avalanche/proofbuilder.cpp.o
[210/492] Building CXX object src/CMakeFiles/server.dir/config.cpp.o
[211/492] Building CXX object src/CMakeFiles/server.dir/banman.cpp.o
[212/492] Building CXX object src/CMakeFiles/server.dir/consensus/activation.cpp.o
[213/492] Building CXX object src/CMakeFiles/server.dir/consensus/tx_verify.cpp.o
[214/492] Building CXX object src/CMakeFiles/server.dir/checkpoints.cpp.o
[215/492] Building CXX object src/CMakeFiles/server.dir/addrdb.cpp.o
[216/492] Building CXX object src/CMakeFiles/server.dir/addrman.cpp.o
[217/492] Building CXX object src/CMakeFiles/server.dir/flatfile.cpp.o
[218/492] Building CXX object src/CMakeFiles/server.dir/avalanche/peermanager.cpp.o
[219/492] Building CXX object src/CMakeFiles/server.dir/blockencodings.cpp.o
[220/492] Building CXX object src/CMakeFiles/server.dir/dbwrapper.cpp.o
[221/492] Building CXX object src/CMakeFiles/server.dir/httpserver.cpp.o
[222/492] Building CXX object src/CMakeFiles/server.dir/httprpc.cpp.o
[223/492] Building CXX object src/CMakeFiles/server.dir/interfaces/chain.cpp.o
FAILED: src/CMakeFiles/server.dir/interfaces/chain.cpp.o 
/usr/bin/ccache /usr/bin/c++  -DBOOST_AC_USE_STD_ATOMIC -DBOOST_SP_USE_STD_ATOMIC -DBUILD_BITCOIN_INTERNAL -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/leveldb/helpers/memenv -I../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -g -O2 -fPIC -fvisibility=hidden   -fstack-reuse=none -fstack-protector-all -Wstack-protector -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wshadow -Wredundant-decls -Wformat-security -Wno-unused-parameter -Wno-implicit-fallthrough -pthread -std=gnu++17 -MD -MT src/CMakeFiles/server.dir/interfaces/chain.cpp.o -MF src/CMakeFiles/server.dir/interfaces/chain.cpp.o.d -o src/CMakeFiles/server.dir/interfaces/chain.cpp.o -c ../../src/interfaces/chain.cpp
In file included from ../../src/interfaces/chain.cpp:5:
../../src/./interfaces/chain.h:299:55: error: ‘std::function’ has not been declared
     virtual void rpcRunLater(const std::string &name, std::function<void()> fn,
                                                       ^~~
../../src/./interfaces/chain.h:299:68: error: expected ‘,’ or ‘...’ before ‘<’ token
     virtual void rpcRunLater(const std::string &name, std::function<void()> fn,
                                                                    ^
../../src/interfaces/chain.cpp:431:14: error: ‘void interfaces::{anonymous}::ChainImpl::rpcRunLater(const string&, std::function<void()>, int64_t)’ marked ‘override’, but does not override
         void rpcRunLater(const std::string &name, std::function<void()> fn,
              ^~~~~~~~~~~
In file included from /usr/include/c++/8/memory:80,
                 from ../../src/./serialize.h:20,
                 from ../../src/./amount.h:10,
                 from ../../src/./primitives/transaction.h:10,
                 from ../../src/./interfaces/chain.h:8,
                 from ../../src/interfaces/chain.cpp:5:
/usr/include/c++/8/bits/unique_ptr.h: In instantiation of ‘typename std::_MakeUniq<_Tp>::__single_object std::make_unique(_Args&& ...) [with _Tp = interfaces::{anonymous}::ChainImpl; _Args = {NodeContext&, const CChainParams&}; typename std::_MakeUniq<_Tp>::__single_object = std::unique_ptr<interfaces::{anonymous}::ChainImpl, std::default_delete<interfaces::{anonymous}::ChainImpl> >]’:
../../src/interfaces/chain.cpp:450:52:   required from here
/usr/include/c++/8/bits/unique_ptr.h:831:30: error: invalid new-expression of abstract class type ‘interfaces::{anonymous}::ChainImpl’
     { return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); }
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../src/interfaces/chain.cpp:165:11: note:   because the following virtual functions are pure within ‘interfaces::{anonymous}::ChainImpl’:
     class ChainImpl : public Chain {
           ^~~~~~~~~
In file included from ../../src/interfaces/chain.cpp:5:
../../src/./interfaces/chain.h:299:18: note: 	‘virtual void interfaces::Chain::rpcRunLater(const string&, int)’
     virtual void rpcRunLater(const std::string &name, std::function<void()> fn,
                  ^~~~~~~~~~~
[224/492] Building CXX object src/CMakeFiles/server.dir/avalanche/processor.cpp.o
[225/492] Building CXX object src/CMakeFiles/server.dir/index/base.cpp.o
[226/492] Building CXX object src/CMakeFiles/server.dir/minerfund.cpp.o
[227/492] Building CXX object src/CMakeFiles/server.dir/index/blockfilterindex.cpp.o
[228/492] Building CXX object src/CMakeFiles/server.dir/interfaces/node.cpp.o
[229/492] Building CXX object src/CMakeFiles/server.dir/node/coin.cpp.o
[230/492] Building CXX object src/CMakeFiles/server.dir/index/txindex.cpp.o
[231/492] Building CXX object src/CMakeFiles/server.dir/node/coinstats.cpp.o
[232/492] Building CXX object src/CMakeFiles/server.dir/miner.cpp.o
[233/492] Building CXX object src/CMakeFiles/server.dir/net.cpp.o
[234/492] Building CXX object src/CMakeFiles/server.dir/validation.cpp.o
[235/492] Building CXX object src/CMakeFiles/server.dir/net_processing.cpp.o
[236/492] Building CXX object src/CMakeFiles/server.dir/init.cpp.o
ninja: build stopped: subcommand failed.
Build build-diff failed with exit code 1

Tail of the build log:

[266/442] Building CXX object src/CMakeFiles/server.dir/chain.cpp.o
[267/442] Building CXX object src/CMakeFiles/server.dir/banman.cpp.o
[268/442] Building CXX object src/CMakeFiles/bitcoin-cli.dir/bitcoin-cli.cpp.o
[269/442] Building CXX object src/CMakeFiles/server.dir/addrdb.cpp.o
[270/442] Building CXX object src/CMakeFiles/server.dir/consensus/activation.cpp.o
[271/442] Building CXX object src/CMakeFiles/server.dir/consensus/tx_verify.cpp.o
[272/442] Building CXX object src/CMakeFiles/server.dir/avalanche/peermanager.cpp.o
[273/442] Building CXX object src/CMakeFiles/server.dir/checkpoints.cpp.o
[274/442] Building CXX object src/CMakeFiles/server.dir/blockencodings.cpp.o
[275/442] Building CXX object src/CMakeFiles/server.dir/flatfile.cpp.o
[276/442] Building CXX object src/CMakeFiles/bitcoin-tx.dir/bitcoin-tx.cpp.o
[277/442] Building CXX object src/CMakeFiles/server.dir/dbwrapper.cpp.o
[278/442] Building CXX object src/CMakeFiles/server.dir/avalanche/processor.cpp.o
[279/442] Building CXX object src/CMakeFiles/server.dir/httpserver.cpp.o
[280/442] Building CXX object src/CMakeFiles/server.dir/interfaces/chain.cpp.o
FAILED: src/CMakeFiles/server.dir/interfaces/chain.cpp.o 
/usr/bin/ccache /usr/bin/c++  -DBOOST_AC_USE_STD_ATOMIC -DBOOST_SP_USE_STD_ATOMIC -DBUILD_BITCOIN_INTERNAL -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/leveldb/helpers/memenv -I../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -g -O2 -fPIC -fvisibility=hidden   -fstack-reuse=none -fstack-protector-all -Wstack-protector -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wshadow -Wredundant-decls -Wformat-security -Wno-unused-parameter -Wno-implicit-fallthrough -pthread -std=gnu++17 -MD -MT src/CMakeFiles/server.dir/interfaces/chain.cpp.o -MF src/CMakeFiles/server.dir/interfaces/chain.cpp.o.d -o src/CMakeFiles/server.dir/interfaces/chain.cpp.o -c ../../src/interfaces/chain.cpp
In file included from ../../src/interfaces/chain.cpp:5:
../../src/./interfaces/chain.h:299:55: error: ‘std::function’ has not been declared
     virtual void rpcRunLater(const std::string &name, std::function<void()> fn,
                                                       ^~~
../../src/./interfaces/chain.h:299:68: error: expected ‘,’ or ‘...’ before ‘<’ token
     virtual void rpcRunLater(const std::string &name, std::function<void()> fn,
                                                                    ^
../../src/interfaces/chain.cpp:431:14: error: ‘void interfaces::{anonymous}::ChainImpl::rpcRunLater(const string&, std::function<void()>, int64_t)’ marked ‘override’, but does not override
         void rpcRunLater(const std::string &name, std::function<void()> fn,
              ^~~~~~~~~~~
In file included from /usr/include/c++/8/memory:80,
                 from ../../src/./serialize.h:20,
                 from ../../src/./amount.h:10,
                 from ../../src/./primitives/transaction.h:10,
                 from ../../src/./interfaces/chain.h:8,
                 from ../../src/interfaces/chain.cpp:5:
/usr/include/c++/8/bits/unique_ptr.h: In instantiation of ‘typename std::_MakeUniq<_Tp>::__single_object std::make_unique(_Args&& ...) [with _Tp = interfaces::{anonymous}::ChainImpl; _Args = {NodeContext&, const CChainParams&}; typename std::_MakeUniq<_Tp>::__single_object = std::unique_ptr<interfaces::{anonymous}::ChainImpl, std::default_delete<interfaces::{anonymous}::ChainImpl> >]’:
../../src/interfaces/chain.cpp:450:52:   required from here
/usr/include/c++/8/bits/unique_ptr.h:831:30: error: invalid new-expression of abstract class type ‘interfaces::{anonymous}::ChainImpl’
     { return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); }
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../src/interfaces/chain.cpp:165:11: note:   because the following virtual functions are pure within ‘interfaces::{anonymous}::ChainImpl’:
     class ChainImpl : public Chain {
           ^~~~~~~~~
In file included from ../../src/interfaces/chain.cpp:5:
../../src/./interfaces/chain.h:299:18: note: 	‘virtual void interfaces::Chain::rpcRunLater(const string&, int)’
     virtual void rpcRunLater(const std::string &name, std::function<void()> fn,
                  ^~~~~~~~~~~
[281/442] Building CXX object src/CMakeFiles/server.dir/httprpc.cpp.o
[282/442] Building CXX object src/CMakeFiles/server.dir/index/base.cpp.o
[283/442] Building CXX object src/CMakeFiles/server.dir/index/blockfilterindex.cpp.o
[284/442] Building CXX object src/CMakeFiles/server.dir/minerfund.cpp.o
[285/442] Building CXX object src/CMakeFiles/server.dir/node/coin.cpp.o
[286/442] Building CXX object src/CMakeFiles/server.dir/index/txindex.cpp.o
[287/442] Building CXX object src/CMakeFiles/server.dir/node/context.cpp.o
[288/442] Building CXX object src/CMakeFiles/server.dir/interfaces/node.cpp.o
[289/442] Building CXX object src/CMakeFiles/server.dir/node/coinstats.cpp.o
[290/442] Building CXX object src/CMakeFiles/server.dir/miner.cpp.o
[291/442] Building CXX object src/CMakeFiles/server.dir/net.cpp.o
[292/442] Building CXX object src/CMakeFiles/server.dir/net_processing.cpp.o
[293/442] Building CXX object src/CMakeFiles/server.dir/init.cpp.o
ninja: build stopped: subcommand failed.
Build build-without-wallet failed with exit code 1

Tail of the build log:

[212/492] Building CXX object src/CMakeFiles/server.dir/blockindex.cpp.o
[213/492] Building CXX object src/CMakeFiles/server.dir/chain.cpp.o
[214/492] Building CXX object src/CMakeFiles/server.dir/consensus/tx_verify.cpp.o
[215/492] Building CXX object src/CMakeFiles/server.dir/consensus/activation.cpp.o
[216/492] Building CXX object src/CMakeFiles/server.dir/flatfile.cpp.o
[217/492] Building CXX object src/CMakeFiles/server.dir/banman.cpp.o
[218/492] Building CXX object src/CMakeFiles/server.dir/dbwrapper.cpp.o
[219/492] Building CXX object src/CMakeFiles/server.dir/addrman.cpp.o
[220/492] Building CXX object src/CMakeFiles/server.dir/checkpoints.cpp.o
[221/492] Building CXX object src/CMakeFiles/server.dir/avalanche/peermanager.cpp.o
[222/492] Building CXX object src/CMakeFiles/server.dir/addrdb.cpp.o
[223/492] Building CXX object src/CMakeFiles/server.dir/httpserver.cpp.o
[224/492] Building CXX object src/CMakeFiles/server.dir/blockencodings.cpp.o
[225/492] Building CXX object src/CMakeFiles/server.dir/index/base.cpp.o
[226/492] Building CXX object src/CMakeFiles/server.dir/httprpc.cpp.o
[227/492] Building CXX object src/CMakeFiles/server.dir/avalanche/processor.cpp.o
[228/492] Building CXX object src/CMakeFiles/server.dir/interfaces/chain.cpp.o
FAILED: src/CMakeFiles/server.dir/interfaces/chain.cpp.o 
/usr/bin/ccache /usr/bin/clang++  -DBOOST_AC_USE_STD_ATOMIC -DBOOST_SP_USE_STD_ATOMIC -DBUILD_BITCOIN_INTERNAL -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/leveldb/helpers/memenv -I../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -g -O2 -fPIC -fvisibility=hidden   -fstack-protector-all -Wstack-protector -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wthread-safety -Wshadow -Wshadow-field -Wrange-loop-analysis -Wredundant-decls -Wformat-security -Wredundant-move -Wno-unused-parameter -Wno-implicit-fallthrough -pthread -std=gnu++17 -MD -MT src/CMakeFiles/server.dir/interfaces/chain.cpp.o -MF src/CMakeFiles/server.dir/interfaces/chain.cpp.o.d -o src/CMakeFiles/server.dir/interfaces/chain.cpp.o -c ../../src/interfaces/chain.cpp
In file included from ../../src/interfaces/chain.cpp:5:
../../src/./interfaces/chain.h:299:60: error: no template named 'function' in namespace 'std'
    virtual void rpcRunLater(const std::string &name, std::function<void()> fn,
                                                      ~~~~~^
../../src/interfaces/chain.cpp:432:43: error: non-virtual member function marked 'override' hides virtual member function
                         int64_t seconds) override {
                                          ^
../../src/./interfaces/chain.h:299:18: note: hidden overloaded virtual function 'interfaces::Chain::rpcRunLater' declared here: type mismatch at 2nd parameter ('int' vs 'std::function<void ()>')
    virtual void rpcRunLater(const std::string &name, std::function<void()> fn,
                 ^
In file included from ../../src/interfaces/chain.cpp:5:
In file included from ../../src/./interfaces/chain.h:8:
In file included from ../../src/./primitives/transaction.h:10:
In file included from ../../src/./amount.h:10:
In file included from ../../src/./serialize.h:20:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/memory:80:
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/unique_ptr.h:831:34: error: allocating an object of abstract class type 'interfaces::(anonymous namespace)::ChainImpl'
    { return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); }
                                 ^
../../src/interfaces/chain.cpp:450:17: note: in instantiation of function template specialization 'std::make_unique<interfaces::(anonymous namespace)::ChainImpl, NodeContext &, const CChainParams &>' requested here
    return std::make_unique<ChainImpl>(node, params);
                ^
../../src/./interfaces/chain.h:299:18: note: unimplemented pure virtual method 'rpcRunLater' in 'ChainImpl'
    virtual void rpcRunLater(const std::string &name, std::function<void()> fn,
                 ^
3 errors generated.
[229/492] Building CXX object src/CMakeFiles/server.dir/node/context.cpp.o
[230/492] Building CXX object src/CMakeFiles/server.dir/index/blockfilterindex.cpp.o
[231/492] Building CXX object src/CMakeFiles/server.dir/minerfund.cpp.o
[232/492] Building CXX object src/CMakeFiles/server.dir/index/txindex.cpp.o
[233/492] Building CXX object src/CMakeFiles/server.dir/node/coin.cpp.o
[234/492] Building CXX object src/CMakeFiles/server.dir/interfaces/node.cpp.o
[235/492] Building CXX object src/CMakeFiles/server.dir/node/coinstats.cpp.o
[236/492] Building CXX object src/CMakeFiles/server.dir/node/psbt.cpp.o
[237/492] Building CXX object src/CMakeFiles/server.dir/miner.cpp.o
[238/492] Building CXX object src/CMakeFiles/server.dir/net.cpp.o
[239/492] Building CXX object src/CMakeFiles/server.dir/init.cpp.o
[240/492] Building CXX object src/CMakeFiles/server.dir/validation.cpp.o
[241/492] Building CXX object src/CMakeFiles/server.dir/net_processing.cpp.o
ninja: build stopped: subcommand failed.
Build build-clang failed with exit code 1

investigating failure

Tail of the build log:

[171/490] Building C object src/secp256k1/CMakeFiles/secp256k1.dir/src/secp256k1.c.o
[172/490] Building C object src/secp256k1/CMakeFiles/ecmult-bench.dir/src/bench_ecmult.c.o
[173/490] Building C object src/secp256k1/CMakeFiles/internal-bench.dir/src/bench_internal.c.o
[174/490] Building CXX object src/CMakeFiles/server.dir/config.cpp.o
[175/490] Building CXX object src/CMakeFiles/server.dir/blockindex.cpp.o
[176/490] Building CXX object src/CMakeFiles/server.dir/avalanche/proof.cpp.o
[177/490] Building CXX object src/CMakeFiles/server.dir/blockfilter.cpp.o
[178/490] Building CXX object src/CMakeFiles/server.dir/avalanche/proofbuilder.cpp.o
[179/490] Building CXX object src/CMakeFiles/server.dir/chain.cpp.o
[180/490] Building CXX object src/CMakeFiles/server.dir/banman.cpp.o
[181/490] Building CXX object src/CMakeFiles/server.dir/addrman.cpp.o
[182/490] Building CXX object src/CMakeFiles/server.dir/consensus/tx_verify.cpp.o
[183/490] Building CXX object src/CMakeFiles/server.dir/addrdb.cpp.o
[184/490] Building CXX object src/CMakeFiles/server.dir/consensus/activation.cpp.o
[185/490] Building CXX object src/CMakeFiles/server.dir/flatfile.cpp.o
[186/490] Building CXX object src/CMakeFiles/server.dir/checkpoints.cpp.o
[187/490] Building CXX object src/CMakeFiles/server.dir/dbwrapper.cpp.o
[188/490] Building CXX object src/CMakeFiles/server.dir/blockencodings.cpp.o
[189/490] Building CXX object src/CMakeFiles/server.dir/avalanche/peermanager.cpp.o
[190/490] Building CXX object src/CMakeFiles/server.dir/interfaces/chain.cpp.o
FAILED: src/CMakeFiles/server.dir/interfaces/chain.cpp.o 
/usr/bin/cmake -E __run_co_compile --launcher=/usr/bin/ccache --tidy="/usr/bin/clang-tidy-8;-warnings-as-errors=*" --source=../../src/interfaces/chain.cpp -- /usr/bin/clang++  -DBOOST_AC_USE_STD_ATOMIC -DBOOST_SP_USE_STD_ATOMIC -DBUILD_BITCOIN_INTERNAL -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/leveldb/helpers/memenv -I../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -g -O2 -fPIC -fvisibility=hidden   -fstack-protector-all -Wstack-protector -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wthread-safety -Wshadow -Wshadow-field -Wrange-loop-analysis -Wredundant-decls -Wformat-security -Wredundant-move -Wno-unused-parameter -Wno-implicit-fallthrough -pthread -std=gnu++17 -MD -MT src/CMakeFiles/server.dir/interfaces/chain.cpp.o -MF src/CMakeFiles/server.dir/interfaces/chain.cpp.o.d -o src/CMakeFiles/server.dir/interfaces/chain.cpp.o -c ../../src/interfaces/chain.cpp
../../src/./interfaces/chain.h:299:60: error: no template named 'function' in namespace 'std' [clang-diagnostic-error]
    virtual void rpcRunLater(const std::string &name, std::function<void()> fn,
                                                           ^
/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/unique_ptr.h:831:34: error: allocating an object of abstract class type 'interfaces::(anonymous namespace)::ChainImpl' [clang-diagnostic-error]
    { return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); }
                                 ^
/work/abc-ci-builds/build-clang-tidy/../../src/interfaces/chain.cpp:450:17: note: in instantiation of function template specialization 'std::make_unique<interfaces::(anonymous namespace)::ChainImpl, NodeContext &, const CChainParams &>' requested here
    return std::make_unique<ChainImpl>(node, params);
                ^
../../src/./interfaces/chain.h:299:18: note: unimplemented pure virtual method 'rpcRunLater' in 'ChainImpl'
    virtual void rpcRunLater(const std::string &name, std::function<void()> fn,
                 ^
/work/abc-ci-builds/build-clang-tidy/../../src/interfaces/chain.cpp:432:43: error: non-virtual member function marked 'override' hides virtual member function [clang-diagnostic-error]
                         int64_t seconds) override {
                                          ^
../../src/./interfaces/chain.h:299:18: note: hidden overloaded virtual function 'interfaces::Chain::rpcRunLater' declared here: type mismatch at 2nd parameter ('int' vs 'std::function<void ()>')
    virtual void rpcRunLater(const std::string &name, std::function<void()> fn,
                 ^
3304 warnings and 3 errors generated.
Error while processing /work/abc-ci-builds/build-clang-tidy/../../src/interfaces/chain.cpp.
Suppressed 3304 warnings (3304 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
Found compiler error(s).
[191/490] Building CXX object src/CMakeFiles/server.dir/httpserver.cpp.o
[192/490] Building CXX object src/CMakeFiles/server.dir/avalanche/processor.cpp.o
[193/490] Building CXX object src/CMakeFiles/server.dir/httprpc.cpp.o
[194/490] Building CXX object src/CMakeFiles/server.dir/index/base.cpp.o
[195/490] Building CXX object src/CMakeFiles/server.dir/index/blockfilterindex.cpp.o
[196/490] Building CXX object src/CMakeFiles/server.dir/index/txindex.cpp.o
[197/490] Building CXX object src/CMakeFiles/server.dir/minerfund.cpp.o
[198/490] Building CXX object src/CMakeFiles/server.dir/interfaces/node.cpp.o
[199/490] Building CXX object src/CMakeFiles/server.dir/miner.cpp.o
[200/490] Building CXX object src/CMakeFiles/server.dir/net.cpp.o
[201/490] Building CXX object src/CMakeFiles/server.dir/validation.cpp.o
[202/490] Building CXX object src/CMakeFiles/server.dir/init.cpp.o
[203/490] Building CXX object src/CMakeFiles/server.dir/net_processing.cpp.o
ninja: build stopped: subcommand failed.
Build build-clang-tidy failed with exit code 1

Tail of the build log:

[213/492] Building CXX object src/CMakeFiles/server.dir/chain.cpp.o
[214/492] Building CXX object src/CMakeFiles/server.dir/consensus/tx_verify.cpp.o
[215/492] Building CXX object src/CMakeFiles/server.dir/consensus/activation.cpp.o
[216/492] Building CXX object src/CMakeFiles/server.dir/flatfile.cpp.o
[217/492] Building CXX object src/CMakeFiles/server.dir/banman.cpp.o
[218/492] Building CXX object src/CMakeFiles/server.dir/dbwrapper.cpp.o
[219/492] Building CXX object src/CMakeFiles/server.dir/addrman.cpp.o
[220/492] Building CXX object src/CMakeFiles/server.dir/httpserver.cpp.o
[221/492] Building CXX object src/CMakeFiles/server.dir/addrdb.cpp.o
[222/492] Building CXX object src/CMakeFiles/server.dir/checkpoints.cpp.o
[223/492] Building CXX object src/CMakeFiles/server.dir/httprpc.cpp.o
[224/492] Building CXX object src/CMakeFiles/server.dir/avalanche/peermanager.cpp.o
[225/492] Building CXX object src/CMakeFiles/server.dir/index/base.cpp.o
[226/492] Building CXX object src/CMakeFiles/server.dir/blockencodings.cpp.o
[227/492] Building CXX object src/CMakeFiles/server.dir/interfaces/chain.cpp.o
FAILED: src/CMakeFiles/server.dir/interfaces/chain.cpp.o 
/usr/bin/ccache /usr/bin/c++  -DBOOST_AC_USE_STD_ATOMIC -DBOOST_SP_USE_STD_ATOMIC -DBUILD_BITCOIN_INTERNAL -DDEBUG -DDEBUG_LOCKORDER -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/leveldb/helpers/memenv -I../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -O0 -fPIC -fvisibility=hidden   -g3 -ftrapv -fstack-reuse=none -fstack-protector-all -Wstack-protector -U_FORTIFY_SOURCE -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wshadow -Wredundant-decls -Wformat-security -Wno-unused-parameter -Wno-implicit-fallthrough -pthread -std=gnu++17 -MD -MT src/CMakeFiles/server.dir/interfaces/chain.cpp.o -MF src/CMakeFiles/server.dir/interfaces/chain.cpp.o.d -o src/CMakeFiles/server.dir/interfaces/chain.cpp.o -c ../../src/interfaces/chain.cpp
In file included from ../../src/interfaces/chain.cpp:5:
../../src/./interfaces/chain.h:299:55: error: ‘std::function’ has not been declared
     virtual void rpcRunLater(const std::string &name, std::function<void()> fn,
                                                       ^~~
../../src/./interfaces/chain.h:299:68: error: expected ‘,’ or ‘...’ before ‘<’ token
     virtual void rpcRunLater(const std::string &name, std::function<void()> fn,
                                                                    ^
../../src/interfaces/chain.cpp:431:14: error: ‘void interfaces::{anonymous}::ChainImpl::rpcRunLater(const string&, std::function<void()>, int64_t)’ marked ‘override’, but does not override
         void rpcRunLater(const std::string &name, std::function<void()> fn,
              ^~~~~~~~~~~
In file included from /usr/include/c++/8/memory:80,
                 from ../../src/./serialize.h:20,
                 from ../../src/./amount.h:10,
                 from ../../src/./primitives/transaction.h:10,
                 from ../../src/./interfaces/chain.h:8,
                 from ../../src/interfaces/chain.cpp:5:
/usr/include/c++/8/bits/unique_ptr.h: In instantiation of ‘typename std::_MakeUniq<_Tp>::__single_object std::make_unique(_Args&& ...) [with _Tp = interfaces::{anonymous}::ChainImpl; _Args = {NodeContext&, const CChainParams&}; typename std::_MakeUniq<_Tp>::__single_object = std::unique_ptr<interfaces::{anonymous}::ChainImpl, std::default_delete<interfaces::{anonymous}::ChainImpl> >]’:
../../src/interfaces/chain.cpp:450:52:   required from here
/usr/include/c++/8/bits/unique_ptr.h:831:30: error: invalid new-expression of abstract class type ‘interfaces::{anonymous}::ChainImpl’
     { return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); }
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../src/interfaces/chain.cpp:165:11: note:   because the following virtual functions are pure within ‘interfaces::{anonymous}::ChainImpl’:
     class ChainImpl : public Chain {
           ^~~~~~~~~
In file included from ../../src/interfaces/chain.cpp:5:
../../src/./interfaces/chain.h:299:18: note: 	‘virtual void interfaces::Chain::rpcRunLater(const string&, int)’
     virtual void rpcRunLater(const std::string &name, std::function<void()> fn,
                  ^~~~~~~~~~~
[228/492] Building CXX object src/CMakeFiles/server.dir/index/blockfilterindex.cpp.o
[229/492] Building CXX object src/CMakeFiles/server.dir/avalanche/processor.cpp.o
[230/492] Building CXX object src/CMakeFiles/server.dir/minerfund.cpp.o
[231/492] Building CXX object src/CMakeFiles/server.dir/node/context.cpp.o
[232/492] Building CXX object src/CMakeFiles/server.dir/index/txindex.cpp.o
[233/492] Building CXX object src/CMakeFiles/server.dir/node/coin.cpp.o
[234/492] Building CXX object src/CMakeFiles/server.dir/interfaces/node.cpp.o
[235/492] Building CXX object src/CMakeFiles/server.dir/node/coinstats.cpp.o
[236/492] Building CXX object src/CMakeFiles/server.dir/miner.cpp.o
[237/492] Building CXX object src/CMakeFiles/server.dir/net.cpp.o
[238/492] Building CXX object src/CMakeFiles/server.dir/init.cpp.o
[239/492] Building CXX object src/CMakeFiles/server.dir/validation.cpp.o
[240/492] Building CXX object src/CMakeFiles/server.dir/net_processing.cpp.o
ninja: build stopped: subcommand failed.
Build build-debug failed with exit code 1

Tail of the build log:

[210/492] Building CXX object src/CMakeFiles/server.dir/consensus/tx_verify.cpp.o
[211/492] Building CXX object src/CMakeFiles/util.dir/util/system.cpp.o
[212/492] Building CXX object src/CMakeFiles/server.dir/consensus/activation.cpp.o
[213/492] Building CXX object src/CMakeFiles/server.dir/flatfile.cpp.o
[214/492] Building CXX object src/CMakeFiles/server.dir/banman.cpp.o
[215/492] Building CXX object src/CMakeFiles/server.dir/checkpoints.cpp.o
[216/492] Building CXX object src/CMakeFiles/server.dir/dbwrapper.cpp.o
[217/492] Building CXX object src/CMakeFiles/server.dir/addrdb.cpp.o
[218/492] Building CXX object src/CMakeFiles/server.dir/addrman.cpp.o
[219/492] Building CXX object src/CMakeFiles/server.dir/httpserver.cpp.o
[220/492] Building CXX object src/CMakeFiles/server.dir/avalanche/peermanager.cpp.o
[221/492] Building CXX object src/CMakeFiles/server.dir/httprpc.cpp.o
[222/492] Building CXX object src/CMakeFiles/server.dir/blockencodings.cpp.o
[223/492] Building CXX object src/CMakeFiles/server.dir/index/base.cpp.o
[224/492] Building CXX object src/CMakeFiles/server.dir/interfaces/chain.cpp.o
FAILED: src/CMakeFiles/server.dir/interfaces/chain.cpp.o 
/usr/bin/ccache /usr/bin/c++  -DBOOST_AC_USE_STD_ATOMIC -DBOOST_SP_USE_STD_ATOMIC -DBUILD_BITCOIN_INTERNAL -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/leveldb/helpers/memenv -I../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -g -O2 -fPIC -fvisibility=hidden   -fstack-reuse=none -fstack-protector-all -Wstack-protector -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wshadow -Wredundant-decls -Wformat-security -Wno-unused-parameter -Wno-implicit-fallthrough -pthread -std=gnu++17 -MD -MT src/CMakeFiles/server.dir/interfaces/chain.cpp.o -MF src/CMakeFiles/server.dir/interfaces/chain.cpp.o.d -o src/CMakeFiles/server.dir/interfaces/chain.cpp.o -c ../../src/interfaces/chain.cpp
In file included from ../../src/interfaces/chain.cpp:5:
../../src/./interfaces/chain.h:299:55: error: ‘std::function’ has not been declared
     virtual void rpcRunLater(const std::string &name, std::function<void()> fn,
                                                       ^~~
../../src/./interfaces/chain.h:299:68: error: expected ‘,’ or ‘...’ before ‘<’ token
     virtual void rpcRunLater(const std::string &name, std::function<void()> fn,
                                                                    ^
../../src/interfaces/chain.cpp:431:14: error: ‘void interfaces::{anonymous}::ChainImpl::rpcRunLater(const string&, std::function<void()>, int64_t)’ marked ‘override’, but does not override
         void rpcRunLater(const std::string &name, std::function<void()> fn,
              ^~~~~~~~~~~
In file included from /usr/include/c++/8/memory:80,
                 from ../../src/./serialize.h:20,
                 from ../../src/./amount.h:10,
                 from ../../src/./primitives/transaction.h:10,
                 from ../../src/./interfaces/chain.h:8,
                 from ../../src/interfaces/chain.cpp:5:
/usr/include/c++/8/bits/unique_ptr.h: In instantiation of ‘typename std::_MakeUniq<_Tp>::__single_object std::make_unique(_Args&& ...) [with _Tp = interfaces::{anonymous}::ChainImpl; _Args = {NodeContext&, const CChainParams&}; typename std::_MakeUniq<_Tp>::__single_object = std::unique_ptr<interfaces::{anonymous}::ChainImpl, std::default_delete<interfaces::{anonymous}::ChainImpl> >]’:
../../src/interfaces/chain.cpp:450:52:   required from here
/usr/include/c++/8/bits/unique_ptr.h:831:30: error: invalid new-expression of abstract class type ‘interfaces::{anonymous}::ChainImpl’
     { return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); }
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../src/interfaces/chain.cpp:165:11: note:   because the following virtual functions are pure within ‘interfaces::{anonymous}::ChainImpl’:
     class ChainImpl : public Chain {
           ^~~~~~~~~
In file included from ../../src/interfaces/chain.cpp:5:
../../src/./interfaces/chain.h:299:18: note: 	‘virtual void interfaces::Chain::rpcRunLater(const string&, int)’
     virtual void rpcRunLater(const std::string &name, std::function<void()> fn,
                  ^~~~~~~~~~~
[225/492] Building CXX object src/CMakeFiles/server.dir/avalanche/processor.cpp.o
[226/492] Building CXX object src/CMakeFiles/server.dir/index/blockfilterindex.cpp.o
[227/492] Building CXX object src/CMakeFiles/server.dir/node/coin.cpp.o
[228/492] Building CXX object src/CMakeFiles/server.dir/minerfund.cpp.o
[229/492] Building CXX object src/CMakeFiles/server.dir/index/txindex.cpp.o
[230/492] Building CXX object src/CMakeFiles/server.dir/node/context.cpp.o
[231/492] Building CXX object src/CMakeFiles/server.dir/node/coinstats.cpp.o
[232/492] Building CXX object src/CMakeFiles/server.dir/interfaces/node.cpp.o
[233/492] Building CXX object src/CMakeFiles/server.dir/miner.cpp.o
[234/492] Building CXX object src/CMakeFiles/server.dir/net.cpp.o
[235/492] Building CXX object src/CMakeFiles/server.dir/validation.cpp.o
[236/492] Building CXX object src/CMakeFiles/server.dir/net_processing.cpp.o
[237/492] Building CXX object src/CMakeFiles/server.dir/init.cpp.o
ninja: build stopped: subcommand failed.
Build build-diff failed with exit code 1

Tail of the build log:

[265/442] Building CXX object src/CMakeFiles/script.dir/script/descriptor.cpp.o
[266/442] Building CXX object src/CMakeFiles/server.dir/chain.cpp.o
[267/442] Building CXX object src/CMakeFiles/server.dir/consensus/activation.cpp.o
[268/442] Building CXX object src/CMakeFiles/server.dir/banman.cpp.o
[269/442] Building CXX object src/CMakeFiles/server.dir/addrdb.cpp.o
[270/442] Building CXX object src/CMakeFiles/bitcoin-cli.dir/bitcoin-cli.cpp.o
[271/442] Building CXX object src/CMakeFiles/server.dir/addrman.cpp.o
[272/442] Building CXX object src/CMakeFiles/server.dir/checkpoints.cpp.o
[273/442] Building CXX object src/CMakeFiles/server.dir/flatfile.cpp.o
[274/442] Building CXX object src/CMakeFiles/server.dir/avalanche/peermanager.cpp.o
[275/442] Building CXX object src/CMakeFiles/server.dir/dbwrapper.cpp.o
[276/442] Building CXX object src/CMakeFiles/server.dir/blockencodings.cpp.o
[277/442] Building CXX object src/CMakeFiles/bitcoin-tx.dir/bitcoin-tx.cpp.o
[278/442] Building CXX object src/CMakeFiles/server.dir/avalanche/processor.cpp.o
[279/442] Building CXX object src/CMakeFiles/server.dir/interfaces/chain.cpp.o
FAILED: src/CMakeFiles/server.dir/interfaces/chain.cpp.o 
/usr/bin/ccache /usr/bin/c++  -DBOOST_AC_USE_STD_ATOMIC -DBOOST_SP_USE_STD_ATOMIC -DBUILD_BITCOIN_INTERNAL -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/leveldb/helpers/memenv -I../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -g -O2 -fPIC -fvisibility=hidden   -fstack-reuse=none -fstack-protector-all -Wstack-protector -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wshadow -Wredundant-decls -Wformat-security -Wno-unused-parameter -Wno-implicit-fallthrough -pthread -std=gnu++17 -MD -MT src/CMakeFiles/server.dir/interfaces/chain.cpp.o -MF src/CMakeFiles/server.dir/interfaces/chain.cpp.o.d -o src/CMakeFiles/server.dir/interfaces/chain.cpp.o -c ../../src/interfaces/chain.cpp
In file included from ../../src/interfaces/chain.cpp:5:
../../src/./interfaces/chain.h:299:55: error: ‘std::function’ has not been declared
     virtual void rpcRunLater(const std::string &name, std::function<void()> fn,
                                                       ^~~
../../src/./interfaces/chain.h:299:68: error: expected ‘,’ or ‘...’ before ‘<’ token
     virtual void rpcRunLater(const std::string &name, std::function<void()> fn,
                                                                    ^
../../src/interfaces/chain.cpp:431:14: error: ‘void interfaces::{anonymous}::ChainImpl::rpcRunLater(const string&, std::function<void()>, int64_t)’ marked ‘override’, but does not override
         void rpcRunLater(const std::string &name, std::function<void()> fn,
              ^~~~~~~~~~~
In file included from /usr/include/c++/8/memory:80,
                 from ../../src/./serialize.h:20,
                 from ../../src/./amount.h:10,
                 from ../../src/./primitives/transaction.h:10,
                 from ../../src/./interfaces/chain.h:8,
                 from ../../src/interfaces/chain.cpp:5:
/usr/include/c++/8/bits/unique_ptr.h: In instantiation of ‘typename std::_MakeUniq<_Tp>::__single_object std::make_unique(_Args&& ...) [with _Tp = interfaces::{anonymous}::ChainImpl; _Args = {NodeContext&, const CChainParams&}; typename std::_MakeUniq<_Tp>::__single_object = std::unique_ptr<interfaces::{anonymous}::ChainImpl, std::default_delete<interfaces::{anonymous}::ChainImpl> >]’:
../../src/interfaces/chain.cpp:450:52:   required from here
/usr/include/c++/8/bits/unique_ptr.h:831:30: error: invalid new-expression of abstract class type ‘interfaces::{anonymous}::ChainImpl’
     { return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); }
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../src/interfaces/chain.cpp:165:11: note:   because the following virtual functions are pure within ‘interfaces::{anonymous}::ChainImpl’:
     class ChainImpl : public Chain {
           ^~~~~~~~~
In file included from ../../src/interfaces/chain.cpp:5:
../../src/./interfaces/chain.h:299:18: note: 	‘virtual void interfaces::Chain::rpcRunLater(const string&, int)’
     virtual void rpcRunLater(const std::string &name, std::function<void()> fn,
                  ^~~~~~~~~~~
[280/442] Building CXX object src/CMakeFiles/server.dir/httpserver.cpp.o
[281/442] Building CXX object src/CMakeFiles/server.dir/httprpc.cpp.o
[282/442] Building CXX object src/CMakeFiles/server.dir/index/base.cpp.o
[283/442] Building CXX object src/CMakeFiles/server.dir/minerfund.cpp.o
[284/442] Building CXX object src/CMakeFiles/server.dir/index/blockfilterindex.cpp.o
[285/442] Building CXX object src/CMakeFiles/server.dir/node/coin.cpp.o
[286/442] Building CXX object src/CMakeFiles/server.dir/index/txindex.cpp.o
[287/442] Building CXX object src/CMakeFiles/server.dir/interfaces/node.cpp.o
[288/442] Building CXX object src/CMakeFiles/server.dir/node/coinstats.cpp.o
[289/442] Building CXX object src/CMakeFiles/server.dir/miner.cpp.o
[290/442] Building CXX object src/CMakeFiles/server.dir/net.cpp.o
[291/442] Building CXX object src/CMakeFiles/server.dir/net_processing.cpp.o
[292/442] Building CXX object src/CMakeFiles/server.dir/init.cpp.o
ninja: build stopped: subcommand failed.
Build build-without-wallet failed with exit code 1

missing #include <functional> on chain.h

Failed tests logs:

====== Bitcoin ABC functional tests with the next upgrade activated: wallet_resendwallettransactions.py ======

------- Stdout: -------
2020-11-21T17:26:02.457000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20201121_172451/wallet_resendwallettransactions_579
2020-11-21T17:26:02.844000Z TestFramework (INFO): Create a new transaction and wait until it's broadcast
2020-11-21T17:26:07.622000Z TestFramework (INFO): Create a block
2020-11-21T17:26:07.685000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 120, in main
    self.run_test()
  File "/work/test/functional/wallet_resendwallettransactions.py", line 74, in run_test
    assert_equal(node.p2ps[1].tx_invs_received[txid], 0)
  File "/work/test/functional/test_framework/util.py", line 60, in assert_equal
    for arg in (thing1, thing2) + args)))
AssertionError: not(1 == 0)
2020-11-21T17:26:07.738000Z TestFramework (INFO): Stopping nodes
2020-11-21T17:26:08.192000Z TestFramework (WARNING): Not cleaning up dir /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20201121_172451/wallet_resendwallettransactions_579
2020-11-21T17:26:08.192000Z TestFramework (ERROR): Test failed. Test logging available at /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20201121_172451/wallet_resendwallettransactions_579/test_framework.log
2020-11-21T17:26:08.193000Z TestFramework (ERROR): Hint: Call /work/test/functional/combine_logs.py '/work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20201121_172451/wallet_resendwallettransactions_579' to consolidate all logs

Each failure log is accessible here:
Bitcoin ABC functional tests with the next upgrade activated: wallet_resendwallettransactions.py

make psbt.cpp std::optional use a bit more succint

deadalnix requested changes to this revision.Nov 22 2020, 17:04
deadalnix added a subscriber: deadalnix.

Small changes, but overall, LGTM.

src/interfaces/chain.h
13 ↗(On Diff #25955)

optional ?

src/psbt.cpp
190 ↗(On Diff #25955)

Why not use value_or here ?

This revision now requires changes to proceed.Nov 22 2020, 17:04
src/interfaces/chain.h
13 ↗(On Diff #25955)

turns out boost/optional.hpp in optional.h was bringing in #include <functional> transitively

I'm going to add #include <optional> as well, to avoid relying on this

weirdly, something _other than_ boost/optional.hpp is bringing in functional transitively when compiling with gcc-10 or clang-10/11, since I only need this #include when compiling with gcc-8.3

src/psbt.cpp
190 ↗(On Diff #25955)

it would work if psbt.tx was a std::optional<CMutableTransaction*> instead of a std::optional<CMutableTransaction>.

since MutableTransactionSignatureCreator's ctor takes a const CMutableTransaction* parameter, this is needed to preserve original behavior using Boost:optional::get_ptr(): Returns: If *this is initialized, a pointer to the contained value; else 0 (null).

currently using psbt.tx.value_or(nullptr) doesn't work because is_convertible_v<nullptr_t &&,CMutableTransaction> fails.

#include'd optional in interfaces/chain.h as not to rely on transitive inclusions

This revision is now accepted and ready to land.Nov 23 2020, 15:15