Page MenuHomePhabricator

Use disk magic as sqlite wallet application ID
AbandonedPublic

Authored by PiRK on Nov 26 2021, 15:07.

Details

Reviewers
deadalnix
Group Reviewers
Restricted Project
Summary

Note:
Bitcoin ABC uses a different magic for network and disk messages. See D400 & D666. It makes more sense to use DiskMagic than to use NetMagic for disk data.

This is a backport of core#19077 [19/26]
https://github.com/bitcoin/bitcoin/pull/19077/commits/9d3d2d263c331e3c77b8f0d01ecc9fea0407dd17
Depends on D10566

At this point the code is still not reachable.

Test Plan

With clang-tidy:
ninja all check-all

Event Timeline

PiRK requested review of this revision.Nov 26 2021, 15:08
deadalnix requested changes to this revision.Nov 26 2021, 16:49
deadalnix added a subscriber: deadalnix.

Why does this come AFTER the patch where sqllite DB are created by default?

This is dangerously stupid.

This revision now requires changes to proceed.Nov 26 2021, 16:49
PiRK edited the summary of this revision. (Show Details)

move this commit before the ones in which sqlite db are read (D10567) or created (D10568), so that when the sqlite db start being created they will have the correct application ID

Commit moved from position [21/26] to [19/26]

Tail of the build log:

[347/511] Building CXX object src/wallet/CMakeFiles/wallet.dir/context.cpp.o
[348/511] Building CXX object src/test/CMakeFiles/testutil.dir/util/setup_common.cpp.o
[349/511] Building CXX object src/wallet/CMakeFiles/wallet.dir/coincontrol.cpp.o
[350/511] Building CXX object src/wallet/CMakeFiles/wallet.dir/bdb.cpp.o
[351/511] Building CXX object src/test/CMakeFiles/testutil.dir/util/wallet.cpp.o
[352/511] Building CXX object src/wallet/CMakeFiles/wallet-tool.dir/wallettool.cpp.o
[353/511] Building CXX object src/wallet/CMakeFiles/wallet.dir/__/interfaces/wallet.cpp.o
[354/511] Building CXX object src/wallet/CMakeFiles/wallet.dir/coinselection.cpp.o
[355/511] Building CXX object src/wallet/CMakeFiles/wallet.dir/crypter.cpp.o
[356/511] Building CXX object src/wallet/CMakeFiles/wallet.dir/db.cpp.o
[357/511] Building CXX object src/wallet/CMakeFiles/wallet.dir/fees.cpp.o
[358/511] Building CXX object src/wallet/CMakeFiles/wallet.dir/load.cpp.o
[359/511] Building CXX object src/wallet/CMakeFiles/wallet.dir/salvage.cpp.o
[360/511] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpcdump.cpp.o
[361/511] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/dns.cpp.o
[362/511] Building CXX object src/wallet/CMakeFiles/wallet.dir/scriptpubkeyman.cpp.o
[363/511] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/db.cpp.o
[364/511] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpcwallet.cpp.o
[365/511] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletdb.cpp.o
[366/511] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletutil.cpp.o
[367/511] Building CXX object src/seeder/CMakeFiles/bitcoin-seeder.dir/main.cpp.o
[368/511] Building CXX object src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o
[369/511] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/bitcoin.cpp.o
[370/511] Building C object src/secp256k1/CMakeFiles/secp256k1.dir/src/secp256k1.c.o
[371/511] Linking C static library src/secp256k1/libsecp256k1.a
[372/511] Building C object src/secp256k1/CMakeFiles/internal-bench.dir/src/bench_internal.c.o
[373/511] Building C object src/secp256k1/CMakeFiles/ecmult-bench.dir/src/bench_ecmult.c.o
[374/511] Linking CXX static library src/libbitcoinconsensus.a
[375/511] Installing component secp256k1
-- Install configuration: "RelWithDebInfo"
-- Install component: "secp256k1"
-- Installing: /results/artifacts/lib/libsecp256k1.a
-- Installing: /results/artifacts/include/secp256k1.h
-- Installing: /results/artifacts/include/secp256k1_preallocated.h
-- Installing: /results/artifacts/include/secp256k1_recovery.h
-- Installing: /results/artifacts/include/secp256k1_schnorr.h
[376/511] Linking C executable src/secp256k1/verify-bench
[377/511] Linking C executable src/secp256k1/recover-bench
[378/511] Linking C executable src/secp256k1/sign-bench
[379/511] Linking C executable src/secp256k1/internal-bench
[380/511] Linking C executable src/secp256k1/ecmult-bench
[381/511] Linking CXX static library src/libscript.a
[382/511] Linking CXX static library src/libcommon.a
[383/511] Linking CXX shared library src/libbitcoinconsensus.so.0.24.7
[384/511] Creating library symlink src/libbitcoinconsensus.so.0 src/libbitcoinconsensus.so
[385/511] Linking CXX executable src/bitcoin-cli
[386/511] Linking CXX executable src/bitcoin-tx
[387/511] Building CXX object src/wallet/CMakeFiles/wallet.dir/sqlite.cpp.o
FAILED: src/wallet/CMakeFiles/wallet.dir/sqlite.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 -I../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -isystem /usr/include/jemalloc -Werror -g -O2 -fPIC -fvisibility=hidden -fstack-protector-all -Wstack-protector -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wgnu -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wthread-safety -Wrange-loop-analysis -Wredundant-decls -Wunreachable-code-loop-increment -Wsign-compare -Wconditional-uninitialized -Wformat-security -Wredundant-move -Woverloaded-virtual -Wshadow -Wshadow-field -Wno-unused-parameter -Wno-implicit-fallthrough -pthread -std=gnu++17 -MD -MT src/wallet/CMakeFiles/wallet.dir/sqlite.cpp.o -MF src/wallet/CMakeFiles/wallet.dir/sqlite.cpp.o.d -o src/wallet/CMakeFiles/wallet.dir/sqlite.cpp.o -c ../../src/wallet/sqlite.cpp
../../src/wallet/sqlite.cpp:708:19: error: inequality comparison result unused [-Werror,-Wunused-comparison]
    if (magic_str != std::string("SQLite format 3"), 16) {
        ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../src/wallet/sqlite.cpp:708:19: note: use '|=' to turn this inequality comparison into an or-assignment
    if (magic_str != std::string("SQLite format 3"), 16) {
                  ^~
                  |=
1 error generated.
ninja: build stopped: cannot make progress due to previous errors.
Build build-clang failed with exit code 1
PiRK planned changes to this revision.Dec 1 2021, 08:45

there is a problem with the parenthesis on line sqlite.cpp:708

PiRK edited the test plan for this revision. (Show Details)

fix typo (rebase accident) and include clang-tidy in the test plan

deadalnix requested changes to this revision.Dec 20 2021, 15:59

Clearing my queue.

This revision now requires changes to proceed.Dec 20 2021, 15:59