This refactoring PR deduplicates repeated SQLite blob binding to a statement with a newly introduced helper function BindBlobToStatement, abstracting away the calls to sqlite3_bind_blob(...).
This should be more readable and less error-prone, e.g. in case that the error handling has to be adapted. As a slight drawback, the function where the binding happens is not printed anymore (__func__), i.e. one could argue this is not strictly a refactoring, but IMHO the advantages of deduplication outweigh this; binding errors are purely internal logic errors (wrong use of the sqlite API) rather than something that is dependend on external data like DB content.
wallet: refactor: dedup sqlite blob binding #24486
pull theStack wants to merge 1 commits into bitcoin:master from theStack:202203-wallet-refactor-dedup_sqlite_blob_binding changing 1 files +26 −41-
theStack commented at 7:17 PM on March 6, 2022: member
- DrahtBot added the label Wallet on Mar 6, 2022
-
wallet: refactor: dedup sqlite blob binding 8ea6167099
- theStack force-pushed on Mar 6, 2022
- fanquake requested review from achow101 on Mar 7, 2022
-
fanquake commented at 9:43 AM on March 7, 2022: member
test 2022-03-06T20:03:09.040000Z TestFramework (ERROR): Assertion failed Traceback (most recent call last): File "/tmp/cirrus-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/test_framework.py", line 132, in main self.run_test() File "/tmp/cirrus-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/wallet_taproot.py", line 435, in run_test lambda k1, k2: (key(H_POINT), [multi_a(1, [k1, k2])]) File "/tmp/cirrus-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/wallet_taproot.py", line 336, in do_test self.do_test_addr(comment, pattern, privmap, treefn, keys[0:nkeys]) File "/tmp/cirrus-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/wallet_taproot.py", line 251, in do_test_addr assert_equal(addr_g, addr_r) File "/tmp/cirrus-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/util.py", line 51, in assert_equal raise AssertionError("not(%s)" % " == ".join(str(arg) for arg in (thing1, thing2) + args)) AssertionError: not(bcrt1px3pnh5n8npeqr3cv0aq6dvqpcsujrgksfd6hup8dpa62z3m9jf9s3sk3ve == bcrt1pn2xq83tt55vfsxtwhkx96sanchkjzwg6yqxuewvn6emkfyqnyp0qe5cteg) -
achow101 commented at 10:40 AM on March 7, 2022: member
CI failure is unrelated
-
laanwj commented at 11:56 AM on March 8, 2022: member
Code review ACK 8ea6167099ddfe9a42464c3c8ae2acd895329d4f
Nice cleanup.
-
achow101 commented at 1:11 PM on March 8, 2022: member
ACK 8ea6167099ddfe9a42464c3c8ae2acd895329d4f
-
klementtan commented at 12:37 PM on March 10, 2022: contributor
ACK 8ea6167099ddfe9a42464c3c8ae2acd895329d4f
- klementtan approved
- fanquake merged this on Mar 10, 2022
- fanquake closed this on Mar 10, 2022
- theStack deleted the branch on Mar 10, 2022
- sidhujag referenced this in commit 17060cf935 on Mar 11, 2022
- DrahtBot locked this on Mar 10, 2023