-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Limit the impact of reorganisations on the database (fix #925) #930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/main.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Unchecked" sounds scary. Maybe SetBestChainInner().
And an assert(pindexNew->pprev == pindexBest) would be good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Sometimes a new block arrives in a new chain that was already the best valid one, but wasn't marked that way. This happens for example when network rules change to recover after a fork. In this case, it is not necessary to do the entire reorganisation inside a single db commit. These can become huge, and exceed the objects/lockers limits in bdb. This patch limits the blocks the actual reorganisation is applied to, and adds the next blocks afterwards in separate db transactions.
|
Ack. Passes my testnet reorg tests. |
Limit the impact of reorganisations on the database (fix #925)
Limit the impact of reorganisations on the database (fix #925)
[Backport to BitcoinCore PR 927 - Logging] - Move socket errors below net category
ab441f3 [Net] Add a couple new testnet checkpoints (Fuzzbawls) Pull request description: 1. `1106100` height that zc public spends became available 2. `1112700` random recent testnet block that meets criteria ACKs for commit ab441f: Tree-SHA512: c138a71939e66a0a9ac598a25f6984c4f05f846533ded2a90f0430c7d71608baf81e48e8bd3ca71206794f3212c2f9e3e8ed5cd282f9c9d02a38db61f7585e85
be8d9c2 Merge bitcoin-core/secp256k1#965: gen_context: Don't use any ASM aeece44 gen_context: Don't use any ASM 7688a4f Merge bitcoin-core/secp256k1#963: "Schnorrsig API overhaul" fixups 90e8344 ci: Add C++ test f698caa Use unsigned char consistently for byte arrays b5b8e7b Don't declare constants twice 769528f Don't use string literals for char arrays without NUL termination 2cc3cfa Fix -Wmissing-braces warning in clang 0440945 Merge bitcoin#844: schnorrsig API overhaul ec3aaa5 Merge bitcoin#960: tests_exhaustive: check the result of secp256k1_ecdsa_sign a1ee83c tests_exhaustive: check the result of secp256k1_ecdsa_sign 253f90c Merge bitcoin-core/secp256k1#951: configure: replace AC_PATH_PROG to AC_CHECK_PROG 446d28d Merge bitcoin-core/secp256k1#944: Various improvements related to CFLAGS 0302138 ci: Make compiler warning into errors on CI b924e1e build: Ensure that configure's compile checks default to -O2 7939cd5 build: List *CPPFLAGS before *CFLAGS like on the compiler command line 595e8a3 build: Enable -Wcast-align=strict warning 0725626 build: Use own variable SECP_CFLAGS instead of touching user CFLAGS 4866178 Merge bitcoin-core/secp256k1#955: Add random field multiply/square tests 75ce488 Merge bitcoin-core/secp256k1#959: tests: really test the non-var scalar inverse 41ed139 tests: really test the non-var scalar inverse 5f6ceaf schnorrsig: allow setting MSGLEN != 32 in benchmark fdd06b7 schnorrsig: add tests for sign_custom and varlen msg verification d8d806a schnorrsig: add extra parameter struct for sign_custom a0c3fc1 schnorrsig: allow signing and verification of variable length msgs 5a8e499 Add secp256k1_tagged_sha256 as defined in BIP-340 b6c0b72 schnorrsig: remove noncefp args from sign; add sign_custom function bdf19f1 Add random field multiply/square tests 8ae56e3 Merge bitcoin#879: Avoid passing out-of-bound pointers to 0-size memcpy a4642fa configure: replace AC_PATH_PROG to AC_CHECK_PROG 1758a92 Merge bitcoin#950: ci: Add ppc64le build c58c4ea ci: Add ppc64le build 7973576 Merge bitcoin#662: Add ecmult_gen, ecmult_const and ecmult to benchmark 8f879c2 Fix array size in bench_ecmult 2fe1b50 Add ecmult_gen, ecmult_const and ecmult to benchmark 593e6ba Clean up ecmult_bench to make space for more benchmarks 50f3367 Merge bitcoin#947: ci: Run PRs on merge result even for i686 a35fdd3 ci: Run PRs on merge result even for i686 442cee5 schnorrsig: add algolen argument to nonce_function_hardened df3bfa1 schnorrsig: clarify result of calling nonce_function_bip340 without data 99e8614 README: mention schnorrsig module 3dc8c07 Merge bitcoin#846: ci: Run ASan/LSan and reorganize sanitizer and Valgrind jobs 02dcea1 ci: Make test iterations configurable and tweak for sanitizer builds 489ff5c tests: Treat empty SECP2561_TEST_ITERS as if it was unset fcfcb97 ci: Simplify to use generic wrapper for QEMU, Valgrind, etc de4157f ci: Run ASan/LSan and reorganize sanitizer and Valgrind jobs 399722a Merge bitcoin#941: Clean up git tree 09b3bb8 Clean up git tree bf0ac46 Merge bitcoin#930: Add ARM32/ARM64 CI 202a030 Merge bitcoin#850: add `secp256k1_ec_pubkey_cmp` method 1e78c18 Merge bitcoin-core/secp256k1#940: contrib: Explain explicit header guards 6939487 Merge bitcoin#926: secp256k1.h: clarify that by default arguments must be != NULL 6eceec6 add `secp256k1_xonly_pubkey_cmp` method 0d9561a add `secp256k1_ec_pubkey_cmp` method 22a9ea1 contrib: Explain explicit header guards 6c52ae8 Merge bitcoin#937: Have ge_set_gej_var, gej_double_var and ge_set_all_gej_var initialize all fields of their outputs. 185a6af Merge bitcoin#925: changed include statements without prefix 'include/' 14c9739 tests: Improve secp256k1_ge_set_all_gej_var for some infinity inputs 4a19668 tests: Test secp256k1_ge_set_all_gej_var for all infinity inputs 3c90bdd change local lib headers to be relative for those pointing at "include/" dir 45b6468 Have secp256k1_ge_set_all_gej_var initialize all fields. Previous behaviour would not initialize r->y values in the case where infinity is passed in. Furthermore, the previous behaviour wouldn't initialize anything in the case where all inputs were infinity. 31c0f6d Have secp256k1_gej_double_var initialize all fields. Previous behaviour would not initialize r->x and r->y values in the case where infinity is passed in. dd6c3de Have secp256k1_ge_set_gej_var initialize all fields. Previous behaviour would not initialize r->x and r->y values in the case where infinity is passed in. d0bd269 Merge bitcoin-core/secp256k1#936: Fix gen_context/ASM build on ARM 8bbad7a Add asm build to ARM32 CI 7d65ed5 Add ARM32/ARM64 CI c848352 Makefile.am: Don't pass a variable twice 2161f31 Makefile.am: Honor config when building gen_context 99f47c2 gen_context: Don't use external ASM because it complicates the build 98e0358 Merge bitcoin#933: Avoids a missing brace warning in schnorrsig/tests_impl.h on old compilers 99e2d5b Avoids a missing brace warning in schnorrsig/tests_impl.h on old compilers. 34388af Merge bitcoin#922: Add mingw32-w64/wine CI build 7012a18 Merge bitcoin#928: Define SECP256K1_BUILD in secp256k1.c directly. ed5a199 tests: fopen /dev/urandom in binary mode ae9e648 Define SECP256K1_BUILD in secp256k1.c directly. 4dc37bf Add mingw32-w64/wine CI build 0881633 secp256k1.h: clarify that by default arguments must be != NULL 9570f67 Avoid passing out-of-bound pointers to 0-size memcpy git-subtree-dir: src/secp256k1 git-subtree-split: be8d9c2
Sometimes a new block arrives in a new chain that was already the
best valid one, but wasn't marked that way. This happens for example
when network rules change to recover after a fork.
In this case, it is not necessary to do the entire reorganisation
inside a single db commit. These can become huge, and exceed the
objects/lockers limits in bdb. This patch limits the blocks the
actual reorganisation is applied to, and adds the next blocks
afterwards in separate db transactions.
Mostly-closes #925.