Page MenuHomePhabricator

p2p: Make timeout mockable and type safe, speed up test
ClosedPublic

Authored by PiRK on Feb 2 2022, 16:26.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABCa82bdf5b97a8: p2p: Make timeout mockable and type safe, speed up test
Summary

This is a backport of core#19499 [2/2] and core#23740
https://github.com/bitcoin/bitcoin/pull/19499/commits/fadc0c80ae4e526fb2b503f7cc02f6122aaf1de5

The second PR is a temporary fix for an intermittent failure that will later be reverted in core#23758

Depends on D10964

Test Plan

ninja all check-all

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

PiRK requested review of this revision.Feb 2 2022, 16:26

Tail of the build log:

                    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/chrono:333:23: note: explicit constructor is not a candidate
          constexpr explicit duration(const _Rep2& __rep)
                             ^
../../src/./qt/guiutil.h:270:48: note: passing argument to parameter 'dur' here
QString formatDurationStr(std::chrono::seconds dur);
                                               ^
../../src/qt/rpcconsole.cpp:1291:9: error: no viable conversion from 'const std::chrono::duration<long, std::ratio<1, 1> >' to 'uint64_t' (aka 'unsigned long')
        time_now, std::chrono::seconds{stats->nodeStats.nLastBlockTime}));
        ^~~~~~~~
../../src/./qt/rpcconsole.h:180:40: note: passing argument to parameter 'time_now' here
    QString TimeDurationField(uint64_t time_now, uint64_t time_at_event) const {
                                       ^
../../src/qt/rpcconsole.cpp:1293:9: error: no viable conversion from 'const std::chrono::duration<long, std::ratio<1, 1> >' to 'uint64_t' (aka 'unsigned long')
        time_now, std::chrono::seconds{stats->nodeStats.nLastTXTime}));
        ^~~~~~~~
../../src/./qt/rpcconsole.h:180:40: note: passing argument to parameter 'time_now' here
    QString TimeDurationField(uint64_t time_now, uint64_t time_at_event) const {
                                       ^
../../src/qt/rpcconsole.cpp:1295:27: error: no viable conversion from 'const std::chrono::duration<long, std::ratio<1, 1> >' to 'uint64_t' (aka 'unsigned long')
        TimeDurationField(time_now, stats->nodeStats.m_last_send));
                          ^~~~~~~~
../../src/./qt/rpcconsole.h:180:40: note: passing argument to parameter 'time_now' here
    QString TimeDurationField(uint64_t time_now, uint64_t time_at_event) const {
                                       ^
../../src/qt/rpcconsole.cpp:1297:27: error: no viable conversion from 'const std::chrono::duration<long, std::ratio<1, 1> >' to 'uint64_t' (aka 'unsigned long')
        TimeDurationField(time_now, stats->nodeStats.m_last_recv));
                          ^~~~~~~~
../../src/./qt/rpcconsole.h:180:40: note: passing argument to parameter 'time_now' here
    QString TimeDurationField(uint64_t time_now, uint64_t time_at_event) const {
                                       ^
5 errors generated.
[481/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/qrc_bitcoin_locale.cpp.o
[482/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/openuridialog.cpp.o
[483/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/splashscreen.cpp.o
[484/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/qrimagewidget.cpp.o
[485/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/addresstablemodel.cpp.o
[486/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactionfilterproxy.cpp.o
[487/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/overviewpage.cpp.o
[488/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/receiverequestdialog.cpp.o
[489/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactiondescdialog.cpp.o
[490/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/coincontroldialog.cpp.o
[491/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/recentrequeststablemodel.cpp.o
[492/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactionrecord.cpp.o
[493/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/sendcoinsentry.cpp.o
[494/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/receivecoinsdialog.cpp.o
[495/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/paymentserver.cpp.o
[496/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactionview.cpp.o
[497/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/signverifymessagedialog.cpp.o
[498/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactiontablemodel.cpp.o
[499/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletframe.cpp.o
[500/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletmodeltransaction.cpp.o
[501/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactiondesc.cpp.o
[502/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/paymentrequestplus.cpp.o
[503/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/sendcoinsdialog.cpp.o
[504/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletcontroller.cpp.o
[505/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletview.cpp.o
[506/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletmodel.cpp.o
ninja: build stopped: cannot make progress due to previous errors.
Build build-clang failed with exit code 1

Tail of the build log:

../../src/./qt/rpcconsole.h: In member function ‘QString RPCConsole::TimeDurationField(uint64_t, uint64_t) const’:
../../src/./qt/rpcconsole.h:182:58: error: could not convert ‘(time_now - time_at_event)’ from ‘uint64_t’ {aka ‘long unsigned int’} to ‘std::chrono::seconds’ {aka ‘std::chrono::duration<long int>’}
                    ? GUIUtil::formatDurationStr(time_now - time_at_event)
                                                 ~~~~~~~~~^~~~~~~~~~~~~~~
../../src/qt/rpcconsole.cpp: In member function ‘void RPCConsole::updateDetailWidget()’:
../../src/qt/rpcconsole.cpp:1291:72: error: no matching function for call to ‘RPCConsole::TimeDurationField(const std::chrono::duration<long int>&, std::chrono::seconds)’
         time_now, std::chrono::seconds{stats->nodeStats.nLastBlockTime}));
                                                                        ^
In file included from ../../src/qt/rpcconsole.cpp:9:
../../src/./qt/rpcconsole.h:180:13: note: candidate: ‘QString RPCConsole::TimeDurationField(uint64_t, uint64_t) const’
     QString TimeDurationField(uint64_t time_now, uint64_t time_at_event) const {
             ^~~~~~~~~~~~~~~~~
../../src/./qt/rpcconsole.h:180:13: note:   no known conversion for argument 1 from ‘const std::chrono::duration<long int>’ to ‘uint64_t’ {aka ‘long unsigned int’}
../../src/qt/rpcconsole.cpp:1293:69: error: no matching function for call to ‘RPCConsole::TimeDurationField(const std::chrono::duration<long int>&, std::chrono::seconds)’
         time_now, std::chrono::seconds{stats->nodeStats.nLastTXTime}));
                                                                     ^
In file included from ../../src/qt/rpcconsole.cpp:9:
../../src/./qt/rpcconsole.h:180:13: note: candidate: ‘QString RPCConsole::TimeDurationField(uint64_t, uint64_t) const’
     QString TimeDurationField(uint64_t time_now, uint64_t time_at_event) const {
             ^~~~~~~~~~~~~~~~~
../../src/./qt/rpcconsole.h:180:13: note:   no known conversion for argument 1 from ‘const std::chrono::duration<long int>’ to ‘uint64_t’ {aka ‘long unsigned int’}
../../src/qt/rpcconsole.cpp:1295:65: error: no matching function for call to ‘RPCConsole::TimeDurationField(const std::chrono::duration<long int>&, const seconds&)’
         TimeDurationField(time_now, stats->nodeStats.m_last_send));
                                                                 ^
In file included from ../../src/qt/rpcconsole.cpp:9:
../../src/./qt/rpcconsole.h:180:13: note: candidate: ‘QString RPCConsole::TimeDurationField(uint64_t, uint64_t) const’
     QString TimeDurationField(uint64_t time_now, uint64_t time_at_event) const {
             ^~~~~~~~~~~~~~~~~
../../src/./qt/rpcconsole.h:180:13: note:   no known conversion for argument 1 from ‘const std::chrono::duration<long int>’ to ‘uint64_t’ {aka ‘long unsigned int’}
../../src/qt/rpcconsole.cpp:1297:65: error: no matching function for call to ‘RPCConsole::TimeDurationField(const std::chrono::duration<long int>&, const seconds&)’
         TimeDurationField(time_now, stats->nodeStats.m_last_recv));
                                                                 ^
In file included from ../../src/qt/rpcconsole.cpp:9:
../../src/./qt/rpcconsole.h:180:13: note: candidate: ‘QString RPCConsole::TimeDurationField(uint64_t, uint64_t) const’
     QString TimeDurationField(uint64_t time_now, uint64_t time_at_event) const {
             ^~~~~~~~~~~~~~~~~
../../src/./qt/rpcconsole.h:180:13: note:   no known conversion for argument 1 from ‘const std::chrono::duration<long int>’ to ‘uint64_t’ {aka ‘long unsigned int’}
[486/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactionrecord.cpp.o
[487/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/overviewpage.cpp.o
[488/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/addresstablemodel.cpp.o
[489/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/receiverequestdialog.cpp.o
[490/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactiondescdialog.cpp.o
[491/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/recentrequeststablemodel.cpp.o
[492/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/sendcoinsentry.cpp.o
[493/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/coincontroldialog.cpp.o
[494/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/receivecoinsdialog.cpp.o
[495/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactiontablemodel.cpp.o
[496/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletmodeltransaction.cpp.o
[497/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactionview.cpp.o
[498/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletframe.cpp.o
[499/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/paymentserver.cpp.o
[500/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactiondesc.cpp.o
[501/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/signverifymessagedialog.cpp.o
[502/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/paymentrequestplus.cpp.o
[503/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/sendcoinsdialog.cpp.o
[504/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletcontroller.cpp.o
[505/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletview.cpp.o
[506/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletmodel.cpp.o
ninja: build stopped: cannot make progress due to previous errors.
Build build-debug failed with exit code 1

Tail of the build log:

        time_now, std::chrono::seconds{stats->nodeStats.nLastTXTime}));
        ^
../../src/./qt/rpcconsole.h:180:40: note: passing argument to parameter 'time_now' here
    QString TimeDurationField(uint64_t time_now, uint64_t time_at_event) const {
                                       ^
/work/abc-ci-builds/build-clang-tidy/../../src/qt/rpcconsole.cpp:1295:27: error: no viable conversion from 'const std::chrono::duration<long, std::ratio<1, 1> >' to 'uint64_t' (aka 'unsigned long') [clang-diagnostic-error]
        TimeDurationField(time_now, stats->nodeStats.m_last_send));
                          ^
../../src/./qt/rpcconsole.h:180:40: note: passing argument to parameter 'time_now' here
    QString TimeDurationField(uint64_t time_now, uint64_t time_at_event) const {
                                       ^
/work/abc-ci-builds/build-clang-tidy/../../src/qt/rpcconsole.cpp:1297:27: error: no viable conversion from 'const std::chrono::duration<long, std::ratio<1, 1> >' to 'uint64_t' (aka 'unsigned long') [clang-diagnostic-error]
        TimeDurationField(time_now, stats->nodeStats.m_last_recv));
                          ^
../../src/./qt/rpcconsole.h:180:40: note: passing argument to parameter 'time_now' here
    QString TimeDurationField(uint64_t time_now, uint64_t time_at_event) const {
                                       ^
4323 warnings and 5 errors generated.
Error while processing /work/abc-ci-builds/build-clang-tidy/../../src/qt/rpcconsole.cpp.
Suppressed 4323 warnings (4323 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).
[470/510] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/optionsmodel.cpp.o
[471/510] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/guiutil.cpp.o
[472/510] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/optionsdialog.cpp.o
[473/510] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/coincontroltreewidget.cpp.o
[474/510] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/utilitydialog.cpp.o
[475/510] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/peertablemodel.cpp.o
[476/510] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/trafficgraphwidget.cpp.o
[477/510] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/createwalletdialog.cpp.o
[478/510] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/editaddressdialog.cpp.o
[479/510] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/splashscreen.cpp.o
[480/510] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/askpassphrasedialog.cpp.o
[481/510] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/qrimagewidget.cpp.o
[482/510] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/qrc_bitcoin_locale.cpp.o
[483/510] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/openuridialog.cpp.o
[484/510] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/addresstablemodel.cpp.o
[485/510] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactionfilterproxy.cpp.o
[486/510] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/overviewpage.cpp.o
[487/510] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactiondescdialog.cpp.o
[488/510] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/receiverequestdialog.cpp.o
[489/510] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/recentrequeststablemodel.cpp.o
[490/510] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/coincontroldialog.cpp.o
[491/510] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactionrecord.cpp.o
[492/510] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/sendcoinsentry.cpp.o
[493/510] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/receivecoinsdialog.cpp.o
[494/510] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/paymentserver.cpp.o
[495/510] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletmodeltransaction.cpp.o
[496/510] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/signverifymessagedialog.cpp.o
[497/510] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactionview.cpp.o
[498/510] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactiontablemodel.cpp.o
[499/510] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletframe.cpp.o
[500/510] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactiondesc.cpp.o
[501/510] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/paymentrequestplus.cpp.o
[502/510] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/sendcoinsdialog.cpp.o
[503/510] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletcontroller.cpp.o
[504/510] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletmodel.cpp.o
[505/510] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletview.cpp.o
ninja: build stopped: cannot make progress due to previous errors.
Build build-clang-tidy failed with exit code 1

Tail of the build log:

[435/458] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/platformstyle.cpp.o
[436/458] Linking CXX executable src/bench/bitcoin-bench
[437/458] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/notificator.cpp.o
[438/458] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/qvalidatedlineedit.cpp.o
[439/458] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/qrc_bitcoin.cpp.o
[440/458] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/qvaluecombobox.cpp.o
[441/458] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/clientmodel.cpp.o
[442/458] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/bitcoin.cpp.o
[443/458] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/intro.cpp.o
[444/458] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/optionsdialog.cpp.o
[445/458] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/guiutil.cpp.o
[446/458] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/optionsmodel.cpp.o
[447/458] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/utilitydialog.cpp.o
[448/458] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/qrc_bitcoin_locale.cpp.o
[449/458] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/trafficgraphwidget.cpp.o
[450/458] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/rpcconsole.cpp.o
FAILED: src/qt/CMakeFiles/bitcoin-qt-base.dir/rpcconsole.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 -DHAVE_DECL_EVP_MD_CTX_NEW=1 -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -DQT_CORE_LIB -DQT_DBUS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DUSE_PROTOBUF_MESSAGE_BYTESIZELONG -Isrc/qt/bitcoin-qt-base_autogen/include -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 -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -isystem /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -isystem /usr/include/x86_64-linux-gnu/qt5/QtNetwork -isystem /usr/include/x86_64-linux-gnu/qt5/QtDBus -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 -Wredundant-decls -Wsign-compare -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Wformat-security -Woverloaded-virtual -Wno-unused-parameter -Wno-implicit-fallthrough -pthread -fPIC -std=gnu++17 -MD -MT src/qt/CMakeFiles/bitcoin-qt-base.dir/rpcconsole.cpp.o -MF src/qt/CMakeFiles/bitcoin-qt-base.dir/rpcconsole.cpp.o.d -o src/qt/CMakeFiles/bitcoin-qt-base.dir/rpcconsole.cpp.o -c ../../src/qt/rpcconsole.cpp
In file included from ../../src/qt/rpcconsole.cpp:9:
../../src/./qt/rpcconsole.h: In member function ‘QString RPCConsole::TimeDurationField(uint64_t, uint64_t) const’:
../../src/./qt/rpcconsole.h:182:58: error: could not convert ‘(time_now - time_at_event)’ from ‘uint64_t’ {aka ‘long unsigned int’} to ‘std::chrono::seconds’ {aka ‘std::chrono::duration<long int>’}
                    ? GUIUtil::formatDurationStr(time_now - time_at_event)
                                                 ~~~~~~~~~^~~~~~~~~~~~~~~
../../src/qt/rpcconsole.cpp: In member function ‘void RPCConsole::updateDetailWidget()’:
../../src/qt/rpcconsole.cpp:1291:72: error: no matching function for call to ‘RPCConsole::TimeDurationField(const std::chrono::duration<long int>&, std::chrono::seconds)’
         time_now, std::chrono::seconds{stats->nodeStats.nLastBlockTime}));
                                                                        ^
In file included from ../../src/qt/rpcconsole.cpp:9:
../../src/./qt/rpcconsole.h:180:13: note: candidate: ‘QString RPCConsole::TimeDurationField(uint64_t, uint64_t) const’
     QString TimeDurationField(uint64_t time_now, uint64_t time_at_event) const {
             ^~~~~~~~~~~~~~~~~
../../src/./qt/rpcconsole.h:180:13: note:   no known conversion for argument 1 from ‘const std::chrono::duration<long int>’ to ‘uint64_t’ {aka ‘long unsigned int’}
../../src/qt/rpcconsole.cpp:1293:69: error: no matching function for call to ‘RPCConsole::TimeDurationField(const std::chrono::duration<long int>&, std::chrono::seconds)’
         time_now, std::chrono::seconds{stats->nodeStats.nLastTXTime}));
                                                                     ^
In file included from ../../src/qt/rpcconsole.cpp:9:
../../src/./qt/rpcconsole.h:180:13: note: candidate: ‘QString RPCConsole::TimeDurationField(uint64_t, uint64_t) const’
     QString TimeDurationField(uint64_t time_now, uint64_t time_at_event) const {
             ^~~~~~~~~~~~~~~~~
../../src/./qt/rpcconsole.h:180:13: note:   no known conversion for argument 1 from ‘const std::chrono::duration<long int>’ to ‘uint64_t’ {aka ‘long unsigned int’}
../../src/qt/rpcconsole.cpp:1295:65: error: no matching function for call to ‘RPCConsole::TimeDurationField(const std::chrono::duration<long int>&, const seconds&)’
         TimeDurationField(time_now, stats->nodeStats.m_last_send));
                                                                 ^
In file included from ../../src/qt/rpcconsole.cpp:9:
../../src/./qt/rpcconsole.h:180:13: note: candidate: ‘QString RPCConsole::TimeDurationField(uint64_t, uint64_t) const’
     QString TimeDurationField(uint64_t time_now, uint64_t time_at_event) const {
             ^~~~~~~~~~~~~~~~~
../../src/./qt/rpcconsole.h:180:13: note:   no known conversion for argument 1 from ‘const std::chrono::duration<long int>’ to ‘uint64_t’ {aka ‘long unsigned int’}
../../src/qt/rpcconsole.cpp:1297:65: error: no matching function for call to ‘RPCConsole::TimeDurationField(const std::chrono::duration<long int>&, const seconds&)’
         TimeDurationField(time_now, stats->nodeStats.m_last_recv));
                                                                 ^
In file included from ../../src/qt/rpcconsole.cpp:9:
../../src/./qt/rpcconsole.h:180:13: note: candidate: ‘QString RPCConsole::TimeDurationField(uint64_t, uint64_t) const’
     QString TimeDurationField(uint64_t time_now, uint64_t time_at_event) const {
             ^~~~~~~~~~~~~~~~~
../../src/./qt/rpcconsole.h:180:13: note:   no known conversion for argument 1 from ‘const std::chrono::duration<long int>’ to ‘uint64_t’ {aka ‘long unsigned int’}
[451/458] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/peertablemodel.cpp.o
[452/458] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/splashscreen.cpp.o
ninja: build stopped: cannot make progress due to previous errors.
Build build-without-wallet failed with exit code 1

Tail of the build log:

../../src/qt/rpcconsole.cpp: In member function ‘void RPCConsole::updateDetailWidget()’:
../../src/qt/rpcconsole.cpp:1291:72: error: no matching function for call to ‘RPCConsole::TimeDurationField(const std::chrono::duration<long int>&, std::chrono::seconds)’
         time_now, std::chrono::seconds{stats->nodeStats.nLastBlockTime}));
                                                                        ^
In file included from ../../src/qt/rpcconsole.cpp:9:
../../src/./qt/rpcconsole.h:180:13: note: candidate: ‘QString RPCConsole::TimeDurationField(uint64_t, uint64_t) const’
     QString TimeDurationField(uint64_t time_now, uint64_t time_at_event) const {
             ^~~~~~~~~~~~~~~~~
../../src/./qt/rpcconsole.h:180:13: note:   no known conversion for argument 1 from ‘const std::chrono::duration<long int>’ to ‘uint64_t’ {aka ‘long unsigned int’}
../../src/qt/rpcconsole.cpp:1293:69: error: no matching function for call to ‘RPCConsole::TimeDurationField(const std::chrono::duration<long int>&, std::chrono::seconds)’
         time_now, std::chrono::seconds{stats->nodeStats.nLastTXTime}));
                                                                     ^
In file included from ../../src/qt/rpcconsole.cpp:9:
../../src/./qt/rpcconsole.h:180:13: note: candidate: ‘QString RPCConsole::TimeDurationField(uint64_t, uint64_t) const’
     QString TimeDurationField(uint64_t time_now, uint64_t time_at_event) const {
             ^~~~~~~~~~~~~~~~~
../../src/./qt/rpcconsole.h:180:13: note:   no known conversion for argument 1 from ‘const std::chrono::duration<long int>’ to ‘uint64_t’ {aka ‘long unsigned int’}
../../src/qt/rpcconsole.cpp:1295:65: error: no matching function for call to ‘RPCConsole::TimeDurationField(const std::chrono::duration<long int>&, const seconds&)’
         TimeDurationField(time_now, stats->nodeStats.m_last_send));
                                                                 ^
In file included from ../../src/qt/rpcconsole.cpp:9:
../../src/./qt/rpcconsole.h:180:13: note: candidate: ‘QString RPCConsole::TimeDurationField(uint64_t, uint64_t) const’
     QString TimeDurationField(uint64_t time_now, uint64_t time_at_event) const {
             ^~~~~~~~~~~~~~~~~
../../src/./qt/rpcconsole.h:180:13: note:   no known conversion for argument 1 from ‘const std::chrono::duration<long int>’ to ‘uint64_t’ {aka ‘long unsigned int’}
../../src/qt/rpcconsole.cpp:1297:65: error: no matching function for call to ‘RPCConsole::TimeDurationField(const std::chrono::duration<long int>&, const seconds&)’
         TimeDurationField(time_now, stats->nodeStats.m_last_recv));
                                                                 ^
In file included from ../../src/qt/rpcconsole.cpp:9:
../../src/./qt/rpcconsole.h:180:13: note: candidate: ‘QString RPCConsole::TimeDurationField(uint64_t, uint64_t) const’
     QString TimeDurationField(uint64_t time_now, uint64_t time_at_event) const {
             ^~~~~~~~~~~~~~~~~
../../src/./qt/rpcconsole.h:180:13: note:   no known conversion for argument 1 from ‘const std::chrono::duration<long int>’ to ‘uint64_t’ {aka ‘long unsigned int’}
[482/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/openuridialog.cpp.o
[483/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/qrimagewidget.cpp.o
[484/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/splashscreen.cpp.o
[485/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/addresstablemodel.cpp.o
[486/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactionfilterproxy.cpp.o
[487/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/overviewpage.cpp.o
[488/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactiondescdialog.cpp.o
[489/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/receiverequestdialog.cpp.o
[490/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/sendcoinsentry.cpp.o
[491/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactionrecord.cpp.o
[492/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/recentrequeststablemodel.cpp.o
[493/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/coincontroldialog.cpp.o
[494/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/receivecoinsdialog.cpp.o
[495/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactionview.cpp.o
[496/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactiontablemodel.cpp.o
[497/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletframe.cpp.o
[498/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/signverifymessagedialog.cpp.o
[499/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/paymentserver.cpp.o
[500/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletmodeltransaction.cpp.o
[501/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactiondesc.cpp.o
[502/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/paymentrequestplus.cpp.o
[503/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/sendcoinsdialog.cpp.o
[504/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletcontroller.cpp.o
[505/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletview.cpp.o
[506/512] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletmodel.cpp.o
ninja: build stopped: cannot make progress due to previous errors.
Build build-diff failed with exit code 1
Fabien requested changes to this revision.Feb 2 2022, 17:51
Fabien added a subscriber: Fabien.

Back on your queue

This revision now requires changes to proceed.Feb 2 2022, 17:51

add missing changes in rpcconsole.h

Fabien added inline comments.
src/net.cpp
1428 ↗(On Diff #32152)

std::chrono::seconds{node.nTimeConnected} (note the braces)

This revision is now accepted and ready to land.Feb 3 2022, 08:22
PiRK edited the summary of this revision. (Show Details)

squah with https://github.com/bitcoin/bitcoin/pull/23740 to avoid introducing an intermittent test failure caused by not all time in net is using mocked time, giving "rounding errors"