Commit Graph

22258 Commits

Author SHA1 Message Date
pasta
8205f22d53
docs: add release notes for 18.0.2 2022-09-30 10:23:32 -05:00
Kittywhiskers Van Gogh
666ff7bff9
merge bitcoin#14193: Add missing mempool locks
Co-authored-by: "UdjinM6 <UdjinM6@users.noreply.github.com>"
2022-09-30 10:21:52 -05:00
pasta
96f4022a6a
chore: archive release-nodes.md 2022-09-29 16:40:28 -05:00
pasta
0b60096d8a
chore: bump version to 18.0.2 2022-09-29 16:32:40 -05:00
UdjinM6
e8afde2740
fix: Flush chainstate (and evodb) cache whenever evodb mem usage is getting too high (#5007)
* fix: Flush chainstate (and evodb) cache whenever evodb mem usage is getting too high

* Bump evodb cache to 64MiB
2022-09-29 16:31:28 -05:00
UdjinM6
8efd7f04c6
Merge bitcoin/bitcoin#25739: Update leveldb subtree (#5005)
f608f25313d2867a6abdfc38abdb86da40924cfc Squashed 'src/leveldb/' changes from 330dd6235f..22f1e4a02f (fanquake)

Pull request description:

  Replaces #25463 (for master).

  Includes:
  - https://github.com/bitcoin-core/leveldb-subtree/pull/32

  Guix Build (arm64):
  ```bash
  ed41ae2555ae3b638b65d870cef385805e621481831ae992e84645f5c234af63  guix-build-bec911e37ac8/output/arm-linux-gnueabihf/SHA256SUMS.part
  7d8237026bfccedee0e56e14d7b89cf2dcb52195b94070dc4b6c3c6970fdc774  guix-build-bec911e37ac8/output/arm-linux-gnueabihf/bitcoin-bec911e37ac8-arm-linux-gnueabihf-debug.tar.gz
  1afeff9d70864be66f7ac48d31d1977c7844e2cc117d3f0438fb2f9c6f6a56a4  guix-build-bec911e37ac8/output/arm-linux-gnueabihf/bitcoin-bec911e37ac8-arm-linux-gnueabihf.tar.gz
  ab2df265897a0142093b582d3c61e2b17a713d93e478b47c7aa2b0a677295007  guix-build-bec911e37ac8/output/arm64-apple-darwin/SHA256SUMS.part
  025a52babdee479800801e951f6fe1fe490e1f5fe8361104eb85e7b0319cdb37  guix-build-bec911e37ac8/output/arm64-apple-darwin/bitcoin-bec911e37ac8-arm64-apple-darwin-unsigned.dmg
  7b2992bf5543891b1e6ef4f48c52fc5febc58cc31ccf4307edd27d4d630aa54a  guix-build-bec911e37ac8/output/arm64-apple-darwin/bitcoin-bec911e37ac8-arm64-apple-darwin-unsigned.tar.gz
  3d93eb009ab6459cdca5fe767795f94ba5e00e5969e44bac19c7a5f344d42030  guix-build-bec911e37ac8/output/arm64-apple-darwin/bitcoin-bec911e37ac8-arm64-apple-darwin.tar.gz
  b8c30c5c561c96bc4e280ececc0dd1cd673bc6194591b848903aa6c54c9d37cf  guix-build-bec911e37ac8/output/dist-archive/bitcoin-bec911e37ac8.tar.gz
  cb2632b9b5ff473e504d3d6244191eb5a852718f8ac8bb1032ba1c65e07d6b3f  guix-build-bec911e37ac8/output/powerpc64-linux-gnu/SHA256SUMS.part
  26ecc2f42ce37f8bd7ba24bf2f80f493cd1fd45b58409de71c44e2445c291c8c  guix-build-bec911e37ac8/output/powerpc64-linux-gnu/bitcoin-bec911e37ac8-powerpc64-linux-gnu-debug.tar.gz
  4a83381ea472cc71b4a1c6569483a7e85a5f53065c1633828bf7a75d357b0297  guix-build-bec911e37ac8/output/powerpc64-linux-gnu/bitcoin-bec911e37ac8-powerpc64-linux-gnu.tar.gz
  455a9af5e7ee1c2857d87abec29284ae7bb447cf7cb2b3befa2f8e0a0a8cbec6  guix-build-bec911e37ac8/output/powerpc64le-linux-gnu/SHA256SUMS.part
  3445f53fd150032ec3c3f324e001b4ecf72728900961a7a7789c32ceb7616617  guix-build-bec911e37ac8/output/powerpc64le-linux-gnu/bitcoin-bec911e37ac8-powerpc64le-linux-gnu-debug.tar.gz
  baefeaac88bb4fbf8662c8e1150b043aa2534535a82e828c13e971d2c5fa5cbd  guix-build-bec911e37ac8/output/powerpc64le-linux-gnu/bitcoin-bec911e37ac8-powerpc64le-linux-gnu.tar.gz
  543484396a47def1636d4e54d4a105c7093265c8896165a4140edec10aeef880  guix-build-bec911e37ac8/output/riscv64-linux-gnu/SHA256SUMS.part
  ac1f6e57016703f1319a3ef80014581aee96053e56525b8cd11ada2395496b86  guix-build-bec911e37ac8/output/riscv64-linux-gnu/bitcoin-bec911e37ac8-riscv64-linux-gnu-debug.tar.gz
  f9a2b65ed21f777524b078046c84b98239b0fbb92eae8d840bc7a25cab0eec6d  guix-build-bec911e37ac8/output/riscv64-linux-gnu/bitcoin-bec911e37ac8-riscv64-linux-gnu.tar.gz
  a08ed0ee78ab1c4c815ba8368f1a21d3bd4327ce1104cb3793d63edd2bde1ef4  guix-build-bec911e37ac8/output/x86_64-apple-darwin/SHA256SUMS.part
  74059397c6c8f0e899b60415d1aae04f2f7df18b8f39cea9f314e5e0c2e0ede6  guix-build-bec911e37ac8/output/x86_64-apple-darwin/bitcoin-bec911e37ac8-x86_64-apple-darwin-unsigned.dmg
  6909ff6f59b78059d505f2b98e6fad63a4e3deb843566061c4cd6e94be1de066  guix-build-bec911e37ac8/output/x86_64-apple-darwin/bitcoin-bec911e37ac8-x86_64-apple-darwin-unsigned.tar.gz
  21b45719d927422acc69662108e7255d8cd0b1d832493e70c622c1b1b3a3a314  guix-build-bec911e37ac8/output/x86_64-apple-darwin/bitcoin-bec911e37ac8-x86_64-apple-darwin.tar.gz
  b5fdee6fd2dbcdaa6302f388c7fcaa6d130ff91fd5760e19facf6e24c7216ef6  guix-build-bec911e37ac8/output/x86_64-linux-gnu/SHA256SUMS.part
  56db24b0b0d2f463c8085a12502977c6d4f4ee5b85484e52522361f54ab3a6aa  guix-build-bec911e37ac8/output/x86_64-linux-gnu/bitcoin-bec911e37ac8-x86_64-linux-gnu-debug.tar.gz
  96dbe08e2ed0f68fe734dd6f0280c2d22af7b56c84debde424367054f118173f  guix-build-bec911e37ac8/output/x86_64-linux-gnu/bitcoin-bec911e37ac8-x86_64-linux-gnu.tar.gz
  70ac424b229befb2834a8a02ce27551e3ddde2d438497e8c11a3cedf0cea5d3c  guix-build-bec911e37ac8/output/x86_64-w64-mingw32/SHA256SUMS.part
  bad144a599b28e8dc0018cc2fd1754543e79df39d651e58f565c197241f2b8cb  guix-build-bec911e37ac8/output/x86_64-w64-mingw32/bitcoin-bec911e37ac8-win64-debug.zip
  7ce2e72621eb070a8d23b7edbaaccc9f06257b82b9851c1cad4c61f08d2c7451  guix-build-bec911e37ac8/output/x86_64-w64-mingw32/bitcoin-bec911e37ac8-win64-setup-unsigned.exe
  5f726ef8b478e3ac90b93cd3ae3c38a0e7bffa5f80306c46a7535518a73251c7  guix-build-bec911e37ac8/output/x86_64-w64-mingw32/bitcoin-bec911e37ac8-win64-unsigned.tar.gz
  87cf1a23e948e471ed35c6a518813505c907c58788b55665829e7f12f33bd312  guix-build-bec911e37ac8/output/x86_64-w64-mingw32/bitcoin-bec911e37ac8-win64.zip
  ```

ACKs for top commit:
  hebasto:
    ACK bec911e37ac826d55b789428bc07280abab76443, I have reviewed the code and it looks OK, I agree it can be merged.
  jarolrod:
    ACK bec911e37ac826d55b789428bc07280abab76443

Tree-SHA512: 190381d9489ec6cc52bb9557750925c8574f1344eb6893095e9e31e66a579bd1bc283e8cbfcba52cec3fb072985895f929103b6f5351a23f908bdd0a04b474f1

Co-authored-by: fanquake <fanquake@gmail.com>
2022-09-29 16:30:10 -05:00
UdjinM6
c92cbce6a5
trivial: Fix trailing whitespaces in release notes (#4989)
Local CI linter complains
2022-09-29 16:30:01 -05:00
PastaPastaPasta
4c81f5cfb8
Merge pull request #5017 from kittywhiskers/auxports3
backport: merge bitcoin#15508, #18764, #19264, #19107, #17577, #18783, #15024, #18204, partial #14588, #13932 (auxiliary backports: part 6)
2022-09-29 21:06:02 +02:00
Kittywhiskers Van Gogh
e0bbc59729 merge bitcoin#15938: silence GCC 7 warning "control reaches end of non-void function" (-Wreturn-type) in psbt.cpp 2022-09-24 08:51:05 +05:30
Kittywhiskers Van Gogh
cbf7f596e9 merge bitcoin#18204: improve descriptor cache and cache xpubs 2022-09-24 08:51:05 +05:30
Kittywhiskers Van Gogh
5df05449be merge bitcoin#15024: Allow specific private keys to be derived from descriptor 2022-09-24 08:51:05 +05:30
Kittywhiskers Van Gogh
94bcbf588d merge bitcoin#18783: Add fuzzing harness for MessageSign, MessageVerify and other functions in util/message.h 2022-09-24 08:51:05 +05:30
Kittywhiskers Van Gogh
d155f13c76 merge bitcoin#17577: deduplicate the message sign/verify code 2022-09-24 08:51:05 +05:30
Kittywhiskers Van Gogh
0e58b340e6 merge bitcoin#19107: Move all header verification into the network layer, extend logging 2022-09-24 08:51:05 +05:30
Kittywhiskers Van Gogh
8dc4e05c1a merge bitcoin#19264: don't import asyncio to test magic bytes 2022-09-24 08:51:05 +05:30
Kittywhiskers Van Gogh
3289e55877 merge bitcoin#18764: replace inv type magic numbers by constants 2022-09-24 08:51:05 +05:30
Kittywhiskers Van Gogh
b2d999c3bf merge bitcoin#15508: Refactor analyzepsbt for use outside RPC code 2022-09-24 08:51:04 +05:30
Kittywhiskers Van Gogh
82938bdfb9 trivial: relocate MSG_* constants from mininode to messages 2022-09-24 08:51:04 +05:30
Kittywhiskers Van Gogh
2a3a873524 partial bitcoin#13932: Additional utility RPCs for PSBT
Contains cb40b3abd4514361a024a1e7a1a281da9261261b and 540729ef4bf1b6c6da1ec795e441d2ce56a9a58b

Verbatim for release notes borrowed from https://raw.githubusercontent.com/bitcoin/bitcoin/master/doc/release-notes/release-notes-0.18.0.md
2022-09-24 08:51:04 +05:30
Kittywhiskers Van Gogh
448ad8a198 partial bitcoin#14588: Refactor PSBT signing logic to enforce invariant and fix signing bug
Contains 53e6fffb8f5b10f94708d33d667a67cb91c2d09d, 0f5bda2bd941686620ef0eb90bd7ed973cc7ef73, 65166d4cf828909dc4bc49dd68a58103d015f1fd and 565500508aa5df0011109ebf375ba71b693fc7de
2022-09-24 08:51:04 +05:30
PastaPastaPasta
dd2ae58352
style: rename variable to avoid shadowing (#5020) 2022-09-24 02:45:27 +03:00
UdjinM6
9010b813c7
fix: Flush chainstate (and evodb) cache whenever evodb mem usage is getting too high (#5007)
* fix: Flush chainstate (and evodb) cache whenever evodb mem usage is getting too high

* Bump evodb cache to 64MiB
2022-09-23 18:46:18 +04:00
UdjinM6
3e9d136b3a
Merge bitcoin/bitcoin#25739: Update leveldb subtree (#5005)
f608f25313d2867a6abdfc38abdb86da40924cfc Squashed 'src/leveldb/' changes from 330dd6235f..22f1e4a02f (fanquake)

Pull request description:

  Replaces #25463 (for master).

  Includes:
  - https://github.com/bitcoin-core/leveldb-subtree/pull/32

  Guix Build (arm64):
  ```bash
  ed41ae2555ae3b638b65d870cef385805e621481831ae992e84645f5c234af63  guix-build-bec911e37ac8/output/arm-linux-gnueabihf/SHA256SUMS.part
  7d8237026bfccedee0e56e14d7b89cf2dcb52195b94070dc4b6c3c6970fdc774  guix-build-bec911e37ac8/output/arm-linux-gnueabihf/bitcoin-bec911e37ac8-arm-linux-gnueabihf-debug.tar.gz
  1afeff9d70864be66f7ac48d31d1977c7844e2cc117d3f0438fb2f9c6f6a56a4  guix-build-bec911e37ac8/output/arm-linux-gnueabihf/bitcoin-bec911e37ac8-arm-linux-gnueabihf.tar.gz
  ab2df265897a0142093b582d3c61e2b17a713d93e478b47c7aa2b0a677295007  guix-build-bec911e37ac8/output/arm64-apple-darwin/SHA256SUMS.part
  025a52babdee479800801e951f6fe1fe490e1f5fe8361104eb85e7b0319cdb37  guix-build-bec911e37ac8/output/arm64-apple-darwin/bitcoin-bec911e37ac8-arm64-apple-darwin-unsigned.dmg
  7b2992bf5543891b1e6ef4f48c52fc5febc58cc31ccf4307edd27d4d630aa54a  guix-build-bec911e37ac8/output/arm64-apple-darwin/bitcoin-bec911e37ac8-arm64-apple-darwin-unsigned.tar.gz
  3d93eb009ab6459cdca5fe767795f94ba5e00e5969e44bac19c7a5f344d42030  guix-build-bec911e37ac8/output/arm64-apple-darwin/bitcoin-bec911e37ac8-arm64-apple-darwin.tar.gz
  b8c30c5c561c96bc4e280ececc0dd1cd673bc6194591b848903aa6c54c9d37cf  guix-build-bec911e37ac8/output/dist-archive/bitcoin-bec911e37ac8.tar.gz
  cb2632b9b5ff473e504d3d6244191eb5a852718f8ac8bb1032ba1c65e07d6b3f  guix-build-bec911e37ac8/output/powerpc64-linux-gnu/SHA256SUMS.part
  26ecc2f42ce37f8bd7ba24bf2f80f493cd1fd45b58409de71c44e2445c291c8c  guix-build-bec911e37ac8/output/powerpc64-linux-gnu/bitcoin-bec911e37ac8-powerpc64-linux-gnu-debug.tar.gz
  4a83381ea472cc71b4a1c6569483a7e85a5f53065c1633828bf7a75d357b0297  guix-build-bec911e37ac8/output/powerpc64-linux-gnu/bitcoin-bec911e37ac8-powerpc64-linux-gnu.tar.gz
  455a9af5e7ee1c2857d87abec29284ae7bb447cf7cb2b3befa2f8e0a0a8cbec6  guix-build-bec911e37ac8/output/powerpc64le-linux-gnu/SHA256SUMS.part
  3445f53fd150032ec3c3f324e001b4ecf72728900961a7a7789c32ceb7616617  guix-build-bec911e37ac8/output/powerpc64le-linux-gnu/bitcoin-bec911e37ac8-powerpc64le-linux-gnu-debug.tar.gz
  baefeaac88bb4fbf8662c8e1150b043aa2534535a82e828c13e971d2c5fa5cbd  guix-build-bec911e37ac8/output/powerpc64le-linux-gnu/bitcoin-bec911e37ac8-powerpc64le-linux-gnu.tar.gz
  543484396a47def1636d4e54d4a105c7093265c8896165a4140edec10aeef880  guix-build-bec911e37ac8/output/riscv64-linux-gnu/SHA256SUMS.part
  ac1f6e57016703f1319a3ef80014581aee96053e56525b8cd11ada2395496b86  guix-build-bec911e37ac8/output/riscv64-linux-gnu/bitcoin-bec911e37ac8-riscv64-linux-gnu-debug.tar.gz
  f9a2b65ed21f777524b078046c84b98239b0fbb92eae8d840bc7a25cab0eec6d  guix-build-bec911e37ac8/output/riscv64-linux-gnu/bitcoin-bec911e37ac8-riscv64-linux-gnu.tar.gz
  a08ed0ee78ab1c4c815ba8368f1a21d3bd4327ce1104cb3793d63edd2bde1ef4  guix-build-bec911e37ac8/output/x86_64-apple-darwin/SHA256SUMS.part
  74059397c6c8f0e899b60415d1aae04f2f7df18b8f39cea9f314e5e0c2e0ede6  guix-build-bec911e37ac8/output/x86_64-apple-darwin/bitcoin-bec911e37ac8-x86_64-apple-darwin-unsigned.dmg
  6909ff6f59b78059d505f2b98e6fad63a4e3deb843566061c4cd6e94be1de066  guix-build-bec911e37ac8/output/x86_64-apple-darwin/bitcoin-bec911e37ac8-x86_64-apple-darwin-unsigned.tar.gz
  21b45719d927422acc69662108e7255d8cd0b1d832493e70c622c1b1b3a3a314  guix-build-bec911e37ac8/output/x86_64-apple-darwin/bitcoin-bec911e37ac8-x86_64-apple-darwin.tar.gz
  b5fdee6fd2dbcdaa6302f388c7fcaa6d130ff91fd5760e19facf6e24c7216ef6  guix-build-bec911e37ac8/output/x86_64-linux-gnu/SHA256SUMS.part
  56db24b0b0d2f463c8085a12502977c6d4f4ee5b85484e52522361f54ab3a6aa  guix-build-bec911e37ac8/output/x86_64-linux-gnu/bitcoin-bec911e37ac8-x86_64-linux-gnu-debug.tar.gz
  96dbe08e2ed0f68fe734dd6f0280c2d22af7b56c84debde424367054f118173f  guix-build-bec911e37ac8/output/x86_64-linux-gnu/bitcoin-bec911e37ac8-x86_64-linux-gnu.tar.gz
  70ac424b229befb2834a8a02ce27551e3ddde2d438497e8c11a3cedf0cea5d3c  guix-build-bec911e37ac8/output/x86_64-w64-mingw32/SHA256SUMS.part
  bad144a599b28e8dc0018cc2fd1754543e79df39d651e58f565c197241f2b8cb  guix-build-bec911e37ac8/output/x86_64-w64-mingw32/bitcoin-bec911e37ac8-win64-debug.zip
  7ce2e72621eb070a8d23b7edbaaccc9f06257b82b9851c1cad4c61f08d2c7451  guix-build-bec911e37ac8/output/x86_64-w64-mingw32/bitcoin-bec911e37ac8-win64-setup-unsigned.exe
  5f726ef8b478e3ac90b93cd3ae3c38a0e7bffa5f80306c46a7535518a73251c7  guix-build-bec911e37ac8/output/x86_64-w64-mingw32/bitcoin-bec911e37ac8-win64-unsigned.tar.gz
  87cf1a23e948e471ed35c6a518813505c907c58788b55665829e7f12f33bd312  guix-build-bec911e37ac8/output/x86_64-w64-mingw32/bitcoin-bec911e37ac8-win64.zip
  ```

ACKs for top commit:
  hebasto:
    ACK bec911e37ac826d55b789428bc07280abab76443, I have reviewed the code and it looks OK, I agree it can be merged.
  jarolrod:
    ACK bec911e37ac826d55b789428bc07280abab76443

Tree-SHA512: 190381d9489ec6cc52bb9557750925c8574f1344eb6893095e9e31e66a579bd1bc283e8cbfcba52cec3fb072985895f929103b6f5351a23f908bdd0a04b474f1

Co-authored-by: fanquake <fanquake@gmail.com>
2022-09-23 18:43:39 +04:00
Kittywhiskers Van Gogh
a35245653c
refactor: pass references to objects instead of using global definitions (#4988)
* fix: move chain activation logic downward to succeed LLMQ initialization

* fix: change order of initialization to reflect dependency

* llmq: pass all global pointers invoked as CDSNotificationInterface arguments

* llmq: pass reference to quorumDKGDebugManager instead of invoking global

* llmq: pass reference to quorumBlockProcessor instead of invoking global

* llmq: pass reference to quorumDKGSessionManager instead of invoking global

* llmq: pass reference to quorumManager instead of invoking global

Co-authored-by: "UdjinM6 <UdjinM6@users.noreply.github.com>"

* llmq: pass reference to quorumSigSharesManager within CSigningManager and networking

* llmq: pass reference to quorumSigSharesManager instead of invoking global

* llmq: pass reference to chainLocksHandler instead of querying global

* llmq: pass reference to quorumInstantSendManager instead of querying global

* trivial: accept argument as const where possible

* style: remove an unneeded const_cast and instead pass by const reference

* style: use const where possible

Co-authored-by: pasta <pasta@dashboost.org>
2022-09-22 15:14:48 +04:00
PastaPastaPasta
9293d2f382
Merge pull request #4975 from vijaydasmp/bp2101
backport: bitcoin#18493,18467,18633,18157,18774,19006,18612,20033, 15283
2022-09-21 18:35:26 +04:00
Konstantin Akimov
9845f8c992
Merge bitcoin#17304: refactor: Move many functions into LegacyScriptPubKeyMan and further separate it from CWallet
* MOVEONLY: Reorder LegacyScriptPubKeyMan methods

Can verify move-only with:

    git log -p -n1 --color-moved

This commit is move-only and doesn't change code or affect behavior.

* Refactor: Declare LegacyScriptPubKeyMan methods as virtual

This commit does not change behavior.

* Refactor: Add new ScriptPubKeyMan virtual methods

This commit does not change behavior.

* Refactor: Move SetAddressBook call out of LegacyScriptPubKeyMan::GetNewDestination

This commit does not change behavior.

* Refactor: Move SetWalletFlag out of LegacyScriptPubKeyMan::UpgradeKeyMetadata

This commit does not change behavior.

* Remove SetWalletFlag from WalletStorage

SetWalletFlag is unused.

Does not change any behavior

* Refactor: Remove UnsetWalletFlag call from LegacyScriptPubKeyMan::SetHDSeed

This commit does not change behavior.

* refactor: Replace UnsetWalletFlagWithDB with UnsetBlankWalletFlag in ScriptPubKeyMan

ScriptPubKeyMan is only using UnsetWalletFlagWithDB to unset the blank
wallet flag. Just make that it's own function and not expose the flag
writing directly.

This does not change behavior.

* Refactor: Move SetAddressBookWithDB call out of LegacyScriptPubKeyMan::ImportScriptPubKeys

This commit does not change behavior.

* Refactor: Move LoadKey LegacyScriptPubKeyMan method definition

This commit does not change behavior.

* Refactor: Move GetMetadata code out of getaddressinfo

Easier to review ignoring whitespace:

    git log -p -n1 -w

This commit does not change behavior.

* Refactor: Move MarkUnusedAddresses code out of CWallet::AddToWalletIfInvolvingMe

This commit does not change behavior.

* Refactor: Move HavePrivateKeys code out of CWallet::CreateWalletFromFile

This commit does not change behavior.

* Refactor: Move RewriteDB code out of CWallet

This commit does not change behavior.

* Refactor: Move GetKeypoolSize code out of CWallet

This commit does not change behavior.

* Refactor: Move nTimeFirstKey accesses out of CWallet

This commit does not change behavior.

* Re-order methods of scriptpubkeyman for easier backporting changes in future

* Fixup for missing cs_wallet lock:

```
wallet/wallet.cpp:4536:41: error: calling function 'GetTimeFirstKey' requires holding mutex 'spk_man->cs_wallet' exclusively [-Werror,-Wthread-safety-analysis]
                int64_t time = spk_man->GetTimeFirstKey();
                                        ^
wallet/wallet.cpp:4570:106: error: calling function 'GetTimeFirstKey' requires holding mutex 'walletInstance->m_spk_man->cs_wallet' exclusively [-Werror,-Wthread-safety-analysis]
        walletInstance->WalletLogPrintf("nTimeFirstKey = %u\n",               walletInstance->m_spk_man->GetTimeFirstKey());
```

* Fix 2 locks

* more of "refactor: Replace UnsetWalletFlagWithDB with UnsetBlankWalletFlag in ScriptPubKeyMan"

* Refactoring GetOldestKeyInPool -> GetOldestKeyTimeInPool, partial bitcoin#10235

Co-authored-by: Andrew Chow <achow101-github@achow101.com>
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2022-09-20 11:31:09 +04:00
Konstantin Akimov
7228d918f6
fix(tests): fix for default initialization of structures in messages.py (#5008)
Excepted zeroes in non-initialized data, in-fact there are non-zero characters.

>>> print(b'\\x0'.hex())
5c7830
>>> print(b'\x00'.hex())
00
2022-09-19 13:04:20 +04:00
MarcoFalke
01226e7830
Merge #15283: log: Fix UB with bench on genesis block
ec30a79f1c430cc7fbda37e5d747b0b31b262fa5 Fix UB with bench on genesis block (Gregory Sanders)

Pull request description:

  During the loading of the genesis block, the bench print lines in ConnectTip divide by zero due to early return in ConnectBlock.

ACKs for top commit:
  practicalswift:
    ACK ec30a79f1c430cc7fbda37e5d747b0b31b262fa5
  sipa:
    utACK ec30a79f1c430cc7fbda37e5d747b0b31b262fa5
  promag:
    ACK ec30a79, `nBlocksTotal` is only used in logging.

Tree-SHA512: b3bdbb58d10d002a2293d7f99196b227ed9f4ca8c6cd08981e95cc964be47efed98b91fad276ee6da5cf7e6684610998ace7ce9bace172dd6c51c386d985b83c
2022-09-16 19:22:13 +05:30
MarcoFalke
fce00a8118
Merge #20033: refactor: minor whitespace fixups, s/const/constexpr/ and remove template (followup to #19845)
89836a82eec63f93bbe6c3bd6a52be26e71ab54d style: minor improvements as a followup to #19845 (Vasil Dimov)

Pull request description:

  Address suggestions:
  https://github.com/bitcoin/bitcoin/pull/19845#discussion_r495486760
  https://github.com/bitcoin/bitcoin/pull/19845#discussion_r495488051
  https://github.com/bitcoin/bitcoin/pull/19845#discussion_r495730125

ACKs for top commit:
  jonatack:
    re-ACK 89836a8 change since previous review is replacing std::runtime_error with std::exception, built/ran unit tests with gcc debian 10.2.0-15, then broke a few v3 net_tests involving `BOOST_CHECK_EXCEPTION`, rebuilt, ran `src/test/test_bitcoin -t net_tests -l all` and checked the error reporting.
  hebasto:
    re-ACK 89836a82eec63f93bbe6c3bd6a52be26e71ab54d
  theStack:
    ACK 89836a82eec63f93bbe6c3bd6a52be26e71ab54d

Tree-SHA512: 36477fdccabe5a8ad91fbabb4655cc363a3a7ca237a98ae6dd4a9fae4a4113762040f864d4ca13a47d081f7d16e5bd487edbfb61ab50a37e4a0424e9bec30b24
2022-09-16 19:22:13 +05:30
Wladimir J. van der Laan
f87b37e07b
Merge #18612: script: Remove undocumented and unused operator+
ccccd5190898ece3ac17aa3178f320d091f221df script: Remove undocumented and unused operator+ (MarcoFalke)

Pull request description:

  This operator has no documented use case and is also unused outside of test code. The test code and all other (imaginary) code that might use this operator is written more clear and concise by the existing CScript push operators for opcodes and data.

  Removing the operator is also going to protect against accidentally reintroducing bugs like this 6ff5f718b6 (diff-8458adcedc17d046942185cb709ff5c3L1135) (last time it was used).

ACKs for top commit:
  laanwj:
    ACK ccccd5190898ece3ac17aa3178f320d091f221df

Tree-SHA512: 43898ac77e4d9643d9f8ac6f8f65497a4f0bbb1fb5dcaecc839c3719aa36181ba77befb213e59a9f33a20a29e0173a0e9c4763b1930940b32c3d1598b3e39af9
2022-09-16 19:22:13 +05:30
MarcoFalke
58ba7a3d88
Merge #19006: rpc: Avoid crash when g_thread_http was never started
faf45d1f1f997c316fc4c611a23c4456533eefe9 http: Avoid crash when g_thread_http was never started (MarcoFalke)
fa12a37b27f0570a551b8c103ea6537ee4a8e399 test: Replace inline-comments with logs, pep8 formatting (MarcoFalke)
fa83b39ff3ae3fbad93df002915c0e5f99c104a9 init: Remove confusing and redundant InitError (MarcoFalke)

Pull request description:

  Avoid a crash during shutdown when the init sequence failed for some reason

ACKs for top commit:
  promag:
    Tested ACK faf45d1f1f997c316fc4c611a23c4456533eefe9.
  ryanofsky:
    Code review ACK faf45d1f1f997c316fc4c611a23c4456533eefe9. Thanks for updates, this is much easier to parse for me now. Since previous reviews: split out and reverted some cleanups & replaced chmod with mkdir in test
  hebasto:
    ACK faf45d1f1f997c316fc4c611a23c4456533eefe9, tested on Linux Mint 19.3 with the following patch:

Tree-SHA512: 59632bf01c999e65c724e2728ac103250ccd8b0b16fac19d3a2a82639ab73e4f2efb86c78e63c588a5954625d8d0cf9545e2a7e070e6e15d2a54beeb50e00b61
2022-09-16 19:22:12 +05:30
MarcoFalke
ed096a5d28
Merge #18774: test: added test for upgradewallet RPC
66fe7b1a98c03f690dcf60d359baac124658aeae test: added test for upgradewallet RPC (Harris)

Pull request description:

  This PR adds tests for the newly merged *upgradewallet* RPC.

  Additionally, it expands `test_framework/util.py` by adding the function `adjust_bitcoin_conf_for_pre_17` to support nodes that don't parse configuration sections.

  This test uses two older node versions, v0.15.2 and v0.16.3, to create older wallet versions to be used by `upgradewallet`.

  Fixes https://github.com/bitcoin/bitcoin/issues/18767

Top commit has no ACKs.

Tree-SHA512: bb72ff1e829e2c3954386cc308842820ef0828a4fbb754202b225a8748f92d4dcc5ec77fb146bfd5484a5c2f29ce95adf9f3fb4483437088ff3ea4a8d2c442c1
2022-09-16 19:22:12 +05:30
MarcoFalke
3dde9ab5c3
Merge #18157: doc: fixing init.md documentation to not require rpcpassword
a2a03c3ca94b1cdd279ac09f2a81e04d262586fd fixing documentation to not require rpcpassword (“jkcd”)

Pull request description:

  Configuration section in [doc/init.md](https://github.com/bitcoin/bitcoin/blob/master/doc/init.md) says user must set rpcpassword in order to run bitcoind. Since [71cbea](71cbeaad9a) fixed the code to use a cookie for authentication, it is not mandatory to set rpcpassword in the configuration.

  Fixes #16346

ACKs for top commit:
  hebasto:
    ACK a2a03c3ca94b1cdd279ac09f2a81e04d262586fd, modulo nit

Tree-SHA512: a62816fef78bed32200bb278cfc7aacf6ea154a60fdf5181927e48b806a1bd694bdf3ccec8362f5e58aad694d636c63f540323d54d85b61deaa417b95b8b56eb
2022-09-16 19:22:12 +05:30
MarcoFalke
2e28e6eee3
Merge #18633: test: Properly raise FailedToStartError when rpc shutdown before warmup finished (take 2)
fa03713e133e3017112fdd5c278e0c8643054578 test: Properly raise FailedToStartError when rpc shutdown before warmup finished (take 2) (MarcoFalke)

Pull request description:

  actually (?) fix #18561

  See most recent traceback https://travis-ci.org/github/bitcoin/bitcoin/jobs/674668692#L7062

  I believe the reason the error is still there is that ConnectionResetError is derived from OSError:

  ConnectionResetError(ConnectionError(OSError))

  And IOError is an alias for OSError since python 3.3, see https://docs.python.org/3/library/exceptions.html#IOError

  So fix that by renaming IOError to the alias OSError and move the less specific catch clause down a few lines.

ACKs for top commit:
  jonatack:
    ACK fa03713e133e3017112fdd5c278e0c8643054578

Tree-SHA512: 6e5b214ed9101bf8ebe7472dcc1f9e9d128e2575c93ec00c8d0774ae1a9b52a8c2a653a45a0eab8d881570b08dd5ffeddf5aca88a10438c366e1f633253cb0b5
2022-09-16 19:22:12 +05:30
MarcoFalke
9867af5500
Merge #18467: rpc: Improve documentation and return value of settxfee
38677274f931088218eeb1f258077d3387f39c89 rpc: settxfee respects -maxtxfee wallet setting (Fabian Jahr)
bda84a08a0ac92dff6cadc99cf9bb8c3fadd7e13 rpc: Add documentation for deactivating settxfee (Fabian Jahr)

Pull request description:

  ~~Closes 18315~~

  `settxfee` can be deactivated by passing 0 as the fee. That does not seem to be documented for the user so this PR adds it in the description. The return value of a simple boolean seems also too simplified given the multiple dimensions that this deactivation feature enables. I.e. it does not seem intuitive if the returned boolean shows that the call succeeded or if means that `settxfee` is active. My suggested solution is to change the return value to a JSON object that included the "active" state and the currently set fee rate.

  Examples:
  ```
  $ src/bitcoin-cli settxfee 0.0000000
  {
    "active": false,
    "fee_rate": "0.00000000 BTC/kB"
  }
  $ src/bitcoin-cli settxfee 0.0001
  {
    "active": true,
    "fee_rate": "0.00010000 BTC/kB"
  }
  ```

ACKs for top commit:
  MarcoFalke:
    ACK 38677274f931088218eeb1f258077d3387f39c89, seems useful to error out early instead of later #16257 🕍
  jonatack:
    ACK 38677274f931088218eeb
  meshcollider:
    LGTM, utACK 38677274f931088218eeb1f258077d3387f39c89

Tree-SHA512: 642813b5cf6612abb4b6cb63728081a6bd1659d809e0149c8f56060b6da7253fee989b3b202854f3051df3773c966799af30b612648c466b099f00590f356548
2022-09-16 19:22:11 +05:30
MarcoFalke
4abace34ad
Merge #18493: rpc: Remove deprecated "size" from mempool txs
0753efd9dc8f2e756955a726afbb602d904e1e92 rpc: Remove deprecated "size" from mempool txs (Vasil Dimov)

Pull request description:

  Remove the "size" property of a mempool transaction from RPC replies.

  Deprecated in e16b6a718 in 0.19, about 1 year ago.

ACKs for top commit:
  kristapsk:
    ACK 0753efd9dc8f2e756955a726afbb602d904e1e92

Tree-SHA512: 392ced6764dd6a1d47c6d1dc9de78990cf3384910d801253f8f620bd1751b2676a6b52bee8a30835d28e845d84bfb37431c1d2370f48c9d4dc8e6a48a5ae8b9e
2022-09-16 19:22:08 +05:30
PastaPastaPasta
1c78d69cd4
Merge pull request #5009 from UdjinM6/pr4999_u
backport: bitcoin#15419, #16042, #17288, #16681, #18873, #18617, #18247, #18986, #18474, #19208 (functional tests)
2022-09-16 12:25:24 +04:00
MarcoFalke
566889f5e8
Merge #19208: test: move sync_blocks and sync_mempool functions to test_framework.py
cc84460c164bcb2a874d4f08b3a2624e5ee9ff0a test: move sync_blocks and sync_mempool functions to test_framework.py (Roy Shao)

Pull request description:

  This PR moves `sync_blocks` and `sync_mempool` out from `test_framework/util.py` to `test_framework/test_framework.py` so they can take contextual information of test framework into account.

  * Change all reference callers to call functions from `test_framework.py`
  * Remove `**kwargs` which is not used
  * Take into account of `timeout_factor` when respecting timeout in function implementations.
  * Pass all tests by running `./test/functional/test_runner.py`

  fixes #18930

ACKs for top commit:
  MarcoFalke:
    ACK cc84460c164bcb2a874d4f08b3a2624e5ee9ff0a , reviewed with --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space 💫

Tree-SHA512: a79b2a3fa842fc26a7aacb834bb2aea88b3049916c0b754e60002a77ce94bb5954e0ea3b436bf268e9295efb62d721dfef263a09339a55c684ac3fda388c275e
2022-09-08 03:49:30 +03:00
MarcoFalke
4b70ee4f24
Merge #18474: test: check that peer is connected when calling sync_*
fac3716b09bb9ee121db629873d9694a95cae942 test: check that peer is connected when calling sync_* (MarcoFalke)

Pull request description:

  Without a connection there is no way to sync, so we can fail early and don't have to wait for the timeout

ACKs for top commit:
  jonatack:
    ACK fac3716b09bb9

Tree-SHA512: 12f771473c23e152dae4bfb201fadb2c3530cf439de64fea07d048734614543080a5d05c9c36e6e398c6a69c8279f609d34706599571814172a11bcfbea4a3b9
2022-09-08 01:40:49 +03:00
MarcoFalke
c0e3829631
Merge #18986: tests: Add capability to disable RPC timeout in functional tests
38c3dd9c706e7e84b2a4dbaf1424a3f1c3b694fc docs: Add notes on how to diasble rpc timeout in functional tests while attatching gdb. (codeShark149)
784ae096259955ea7a294114f5c021c9489d2717 test: Add capability to disable RPC timeout in functional tests. (codeShark149)

Pull request description:

  Many times, especially while debugging RPC callbacks to core using gdb, the test timeout kicks in before the response can get back. This can be annoying and requires restarting the functional test as well as gdb attachment.

  This PR adds a `--notimeout` flag into `test_framework` and sets the `rpc_timeout` accordingly if the flag is set.

  The same effect can be achieved with newly added `--factor` flag but keeping a separate flag that explicitly disables the timeout can be easier for new testers to find it out and separates its purpose from the `--factor` flag.

  Requesting review ryanofsky jnewbery as per the IRC discussion.

  Update: After initial round of review, the approach is modified to accommodate the functionality in already existing `--factor` flag. `--factor` is changed to `--timeout-factor` to express its intent better.

ACKs for top commit:
  MarcoFalke:
    ACK 38c3dd9c706e7e84b2a4dbaf1424a3f1c3b694fc and thanks for fixing up all my typos 😅
  jnewbery:
    ACK 38c3dd9c706e7e84b2a4dbaf1424a3f1c3b694fc.

Tree-SHA512: 9458dd1010288c62f8bb83f7a4893284fbbf938882dd65fc9e08810a910db07ef676e3100266028e5d4c8ce407b2267b3860595015da070c84a9d4a9816797db
2022-09-08 00:40:11 +03:00
MarcoFalke
60cfe097be
Merge #18247: test: Wait for both veracks in add_p2p_connection
faf1d047313e71658fb31f6b94fdd5d37705ab85 test: Remove redundant sync_with_ping after add_p2p_connection (MarcoFalke)
fa9064704524a0fd1fa9ea73eea45b07316ac3d1 test: Wait for both veracks in add_p2p_connection (MarcoFalke)

Pull request description:

  This fixes the race in p2p_blocksonly

  E.g. https://travis-ci.org/MarcoFalke/bitcoin-core/jobs/657038844#L4500

  ```
   ...
   test  2020-03-01T20:58:28.825000Z TestFramework.mininode (DEBUG): Closed connection to: 127.0.0.1:11828
   node0 2020-03-01T20:58:28.825642Z [net] disconnecting peer=0
   node0 2020-03-01T20:58:28.825826Z [net] Cleared nodestate for peer=0
   node0 2020-03-01T20:58:28.875835Z [http] Received a POST request for / from 127.0.0.1:53448
   node0 2020-03-01T20:58:28.876067Z [httpworker.0] ThreadRPCServer method=getmempoolinfo user=__cookie__
   test  2020-03-01T20:58:28.877000Z TestFramework.mininode (DEBUG): Connecting to Bitcoin Node: 127.0.0.1:11828
   test  2020-03-01T20:58:28.878000Z TestFramework.mininode (DEBUG): Connected & Listening: 127.0.0.1:11828
   test  2020-03-01T20:58:28.878000Z TestFramework.mininode (DEBUG): Send message to 127.0.0.1:11828: msg_version(nVersion=70014 nServices=9 nTime=Sun Mar  1 20:58:28 2020 addrTo=CAddress(nServices=1 ip=127.0.0.1 port=11828) addrFrom=CAddress(nServices=1 ip=0.0.0.0 port=0) nNonce=0x164D5DEB952A4A0B strSubVer=b'/python-mininode-tester:0.0.3/' nStartingHeight=-1 nRelay=1)
   node0 2020-03-01T20:58:28.883808Z [net] Added connection peer=1
   node0 2020-03-01T20:58:28.883950Z [net] connection from 127.0.0.1:33798 accepted
   node0 2020-03-01T20:58:28.884300Z [msghand] received: version (116 bytes) peer=1
   node0 2020-03-01T20:58:28.884483Z [msghand] sending version (114 bytes) peer=1
   node0 2020-03-01T20:58:28.884700Z [msghand] send version message: version 70015, blocks=200, us=[::]:0, peer=1
   node0 2020-03-01T20:58:28.884765Z [msghand] sending verack (0 bytes) peer=1
   test  2020-03-01T20:58:28.885000Z TestFramework.mininode (DEBUG): Received message from 127.0.0.1:11828: msg_version(nVersion=70015 nServices=1033 nTime=Sun Mar  1 20:58:28 2020 addrTo=CAddress(nServices=0 ip=0.0.0.0 port=0) addrFrom=CAddress(nServices=1033 ip=0.0.0.0 port=0) nNonce=0x4A0F2F4C549B3399 strSubVer=b'/Satoshi:0.19.99(testnode0)/' nStartingHeight=200 nRelay=0)
   test  2020-03-01T20:58:28.885000Z TestFramework.mininode (DEBUG): Send message to 127.0.0.1:11828: msg_verack()
   test  2020-03-01T20:58:28.885000Z TestFramework.mininode (DEBUG): Received message from 127.0.0.1:11828: msg_verack()
   node0 2020-03-01T20:58:28.885004Z [msghand] receive version message: /python-mininode-tester:0.0.3/: version 70014, blocks=-1, us=127.0.0.1:11828, peer=1
   test  2020-03-01T20:58:28.886000Z TestFramework (INFO): Check that txs from rpc are not rejected and relayed to other peers
   node0 2020-03-01T20:58:28.886556Z [http] Received a POST request for / from 127.0.0.1:53448
   node0 2020-03-01T20:58:28.886783Z [httpworker.1] ThreadRPCServer method=getpeerinfo user=__cookie__
   node0 2020-03-01T20:58:28.889032Z [http] Received a POST request for / from 127.0.0.1:53448
   node0 2020-03-01T20:58:28.889294Z [httpworker.2] ThreadRPCServer method=testmempoolaccept user=__cookie__
   node0 2020-03-01T20:58:28.891655Z [http] Received a POST request for / from 127.0.0.1:53448
   node0 2020-03-01T20:58:28.891963Z [httpworker.3] ThreadRPCServer method=sendrawtransaction user=__cookie__
   node0 2020-03-01T20:58:28.893115Z [httpworker.3] Enqueuing TransactionAddedToMempool: txid=af34fc5ff9ea8babbd4083fbb79ffd2ad5aff1d6def803c07ca5aeed880bd60f wtxid=af34fc5ff9ea8babbd4083fbb79ffd2ad5aff1d6def803c07ca5aeed880bd60f
   node0 2020-03-01T20:58:28.893443Z [scheduler] TransactionAddedToMempool: txid=af34fc5ff9ea8babbd4083fbb79ffd2ad5aff1d6def803c07ca5aeed880bd60f wtxid=af34fc5ff9ea8babbd4083fbb79ffd2ad5aff1d6def803c07ca5aeed880bd60f
   node0 2020-03-01T20:58:28.894814Z [msghand] received: verack (0 bytes) peer=1
   node0 2020-03-01T20:58:28.894937Z [msghand] sending sendheaders (0 bytes) peer=1
   node0 2020-03-01T20:58:28.895087Z [msghand] sending sendcmpct (9 bytes) peer=1
   node0 2020-03-01T20:58:28.895235Z [msghand] sending sendcmpct (9 bytes) peer=1
   node0 2020-03-01T20:58:28.895430Z [msghand] sending ping (8 bytes) peer=1
   node0 2020-03-01T20:58:28.895896Z [msghand] initial getheaders (199) to peer=1 (startheight:-1)
   test  2020-03-01T20:58:28.896000Z TestFramework.mininode (DEBUG): Received message from 127.0.0.1:11828: msg_sendheaders()
   node0 2020-03-01T20:58:28.896016Z [msghand] sending getheaders (645 bytes) peer=1
   node0 2020-03-01T20:58:28.896607Z [msghand] sending feefilter (8 bytes) peer=1
   test  2020-03-01T20:58:28.897000Z TestFramework.mininode (DEBUG): Received message from 127.0.0.1:11828: msg_sendcmpct(announce=False, version=2)
   test  2020-03-01T20:58:28.897000Z TestFramework.mininode (DEBUG): Received message from 127.0.0.1:11828: msg_sendcmpct(announce=False, version=1)
   test  2020-03-01T20:58:28.897000Z TestFramework.mininode (DEBUG): Received message from 127.0.0.1:11828: msg_ping(nonce=f735096062d217b5)
   test  2020-03-01T20:58:28.897000Z TestFramework.mininode (DEBUG): Send message to 127.0.0.1:11828: msg_pong(nonce=f735096062d217b5)
   test  2020-03-01T20:58:28.897000Z TestFramework.mininode (DEBUG): Received message from 127.0.0.1:11828: msg_getheaders(locator=CBlockLocator(nVersion=70014 vHave=[48924041037103782797700918670732352379567180837453042168545380831411841797392, 28010422273815860773972769588722664110955084223364219183119416607410792753789, 5954376895683677137597080246740451260829355661937599865380797589540815086241, 14500403275336359851183244421245184901482464358719551678581030092830439955257, 17853919108052771837249729512111680264864054213441538187113939176285784834878, 28843166929059356839755035875664073555480989477... (msg truncated)
   test  2020-03-01T20:58:28.897000Z TestFramework.mininode (DEBUG): Received message from 127.0.0.1:11828: msg_feefilter(feerate=000003e8)
   node0 2020-03-01T20:58:28.898144Z [msghand] received: pong (8 bytes) peer=1
   node0 2020-03-01T20:59:28.338539Z [scheduler] Feeding 13446 bytes of dynamic environment data into RNG
   test  2020-03-01T20:59:28.908000Z TestFramework.utils (ERROR): wait_until() failed. Predicate: ''''
                                             def test_function():
                                                 assert self.is_connected
                                                 if not self.last_message.get('tx'):
                                                     return False
                                                 return self.last_message['tx'].tx.rehash() == txid
                                     '''
   test  2020-03-01T20:59:28.908000Z TestFramework (ERROR): Assertion failed
                                     Traceback (most recent call last):
                                       File "/home/travis/build/MarcoFalke/bitcoin-core/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/test_framework.py", line 112, in main
                                         self.run_test()
                                       File "/home/travis/build/MarcoFalke/bitcoin-core/build/bitcoin-x86_64-pc-linux-gnu/test/functional/p2p_blocksonly.py", line 57, in run_test
                                         self.nodes[0].p2p.wait_for_tx(txid)
                                       File "/home/travis/build/MarcoFalke/bitcoin-core/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/mininode.py", line 369, in wait_for_tx
                                         wait_until(test_function, timeout=timeout, lock=mininode_lock)
                                       File "/home/travis/build/MarcoFalke/bitcoin-core/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/util.py", line 234, in wait_until
                                         raise AssertionError("Predicate {} not true after {} seconds".format(predicate_source, timeout))
                                     AssertionError: Predicate ''''
                                             def test_function():
                                                 assert self.is_connected
                                                 if not self.last_message.get('tx'):
                                                     return False
                                                 return self.last_message['tx'].tx.rehash() == txid
                                     ''' not true after 60 seconds

ACKs for top commit:
  jonatack:
    ACK faf1d04

Tree-SHA512: 3b1a38a5c87d11c610eee0988f0c4af9bfcd978df9ac718ef611f663df2fd4a0eb04e077df5e940d15971bb2f22328fb6021cacccb6902f1e527f288ad2c4a2c
2022-09-08 00:02:35 +03:00
MarcoFalke
6bb3e54578
Merge #18617: test: add factor option to adjust test timeouts
2742c3428633b6ceaab6714635dc3adb74bf121b test: add factor option to adjust test timeouts (Harris)

Pull request description:

  This PR adds a new option **factor** that can be used to adjust timeouts in various functional tests.
  Several timeouts and functions from `authproxy`, `mininode`, `test_node` and `util` have been adapted to use this option. The factor-option definition is located in `test_framework.py`.

  Fixes https://github.com/bitcoin/bitcoin/issues/18266
  Also Fixes https://github.com/bitcoin/bitcoin/issues/18834

ACKs for top commit:
  MarcoFalke:
    Thanks! ACK 2742c3428633b6ceaab6714635dc3adb74bf121b

Tree-SHA512: 6d8421933ba2ac1b7db00b70cf2bc242d9842c48121c11aadc30b0985c4a174c86a127d6402d0cd73b993559d60d4f747872d21f9510cf4806e008349780d3ef
2022-09-08 00:02:35 +03:00
Wladimir J. van der Laan
86a11a83a2
Merge #18873: test: Fix intermittent sync_blocks failures
fa3f9a05660687bf4146e089050e944a1d6cbe3c test: Fix intermittent sync_blocks failures (MarcoFalke)

Pull request description:

  Fixes #18872
  Fixes #18737
  Fixes #18801

  See docstring for motivation and description

ACKs for top commit:
  laanwj:
    Code review ACK fa3f9a05660687bf4146e089050e944a1d6cbe3c

Tree-SHA512: acd52d386a6849f7ff1cb1a51a439dc3c76e0e3a4dd8d22030df0ebb09b44497c61c56331ff65724b695d82d86b0ebb24608f9e637008e5dacb7676b0c448889
2022-09-07 22:25:40 +03:00
MarcoFalke
31a886aa7c
Merge #16681: Tests: Use self.chain instead of 'regtest' in all current tests
1abcecc40c518a98b7d17880657ec0247abdf125 Tests: Use self.chain instead of 'regtest' in almost all current tests (Jorge Timón)

Pull request description:

  Simply avoiding the hardcoded string in more places for consistency.
  It can also allow for more easily reusing tests for other chains other than regtest.

  Separated from #8994 .
  Continues #16509 .

  It is still not complete (ie to be complete, we need the -chain parameter in #16680 and make whether acceptnonstdtxs is allowed for that chain or not customizable for regtest [or for custom chains like in #8994 ] ). But while being incomplete like #16509 , it's quite simple to review and another step forward IMO.

ACKs for top commit:
  Sjors:
    re-ACK 1abcecc. I think it's an improvement even if incomplete and if some PR's might accidentally bring "regtest" back. Subsequent improvements hopefully don't have to touch 16 files.
  elichai:
    Code review ACK 1abcecc40c518a98b7d17880657ec0247abdf125
  ryanofsky:
    Code review ACK 1abcecc40c518a98b7d17880657ec0247abdf125.
  ryanofsky:
    Code review ACK 1abcecc40c518a98b7d17880657ec0247abdf125

Tree-SHA512: 5620de6dab235ca8bd8670d6366c7b9f04f0e3ca9c5e7f87765b38e16ed80c17d7d1630c0d5fd7c5526f070830d94dc74cc2096d8ede87dc7180ed20569509ee
2022-09-07 22:25:40 +03:00
MarcoFalke
ba73a3360a
Merge #17288: Added TestShell class for interactive Python environments.
19139ee034d20ebab1b91d3ac13a8eee70b59374 Add documentation for test_shell submodule (JamesC)
f5112369cf91451d2d0bf574a9bfdaea04696939 Add TestShell class (James Chiang)
5155602a636c323424f75272ccec38588b3d71cd Move argparse() to init() (JamesC)
2ab01462f48b2d4e0d03ba842c3af8851c67c6f1 Move assert num_nodes is set into main() (JamesC)
614c645643e86c4255b98c663c10f2c227158d4b Clear TestNode objects after shutdown (JamesC)
6f40820757d25ff1ccfdfcbdf2b45b8b65308010 Add closing and flushing of logging handlers (JamesC)
6b71241291a184c9ee197bf5f0c7e1414417a0a0 Refactor TestFramework main() into setup/shutdown (JamesC)
ede8b7608e115364b5bb12e7f39d662145733de6 Remove network_event_loop instance in close() (JamesC)

Pull request description:

  This PR refactors BitcoinTestFramework to encapsulate setup and shutdown logic into dedicated methods, and adds a  ~~TestWrapper~~ TestShell child class. This wrapper allows the underlying BitcoinTestFramework to run _between user inputs_ in a REPL environment, such as a Jupyter notebook or any interactive Python3 interpreter.

  The ~~TestWrapper~~ TestShell is motivated by the opportunity to expose the test-framework as a prototyping and educational toolkit. Examples of code prototypes enabled by  ~~TestWrapper~~ TestShell can be found in the Optech [Taproot/Schnorr](https://github.com/bitcoinops/taproot-workshop) workshop repository.

  Usage example:
  ```
  >>> import sys
  >>> sys.path.insert(0, "/path/to/bitcoin/test/functional")
  ```
  ```
  >>> from test_framework.test_wrapper import TestShell
  >>> test = TestShell()
  >>> test.setup(num_nodes=2)
  20XX-XX-XXTXX:XX:XX.XXXXXXX TestFramework (INFO): Initializing test directory /path/to/bitcoin_func_test_XXXXXXX
  ```
  ```
  >>> test.nodes[0].generate(101)
  >>> test.nodes[0].getblockchaininfo()["blocks"]
  101
  ```
  ```
  >>> test.shutdown()
  20XX-XX-XXTXX:XX:XX.XXXXXXX TestFramework (INFO): Stopping nodes
  20XX-XX-XXTXX:XX:XX.XXXXXXX TestFramework (INFO): Cleaning up /path/to/bitcoin_func_test_XXXXXXX on exit
  20XX-XX-XXTXX:XX:XX.XXXXXXX TestFramework (INFO): Tests successful
  ```

  **Overview of changes to BitcoinTestFramework:**

  - Code moved to `setup()/shutdown()` methods.
  - Argument parsing logic encapsulated by `parse_args` method.
  - Success state moved to `BitcoinTestFramework.success`.

  _During Shutdown_

  - `BitcoinTestFramework` logging handlers are flushed and removed.
  - `BitcoinTestFrameowork.nodes` list is cleared.
  - `NetworkThread.network_event_loop` is reset. (NetworkThread class).

  **Behavioural changes:**
  - Test parameters can now also be set when overriding BitcoinTestFramework.setup() in addition to overriding `set_test_params` method.
  - Potential exceptions raised in BitcoinTestFramework.setup() will be handled in main().

  **Added files:**
  - ~~test_wrapper.py~~ `test_shell.py`
  - ~~test-wrapper.md~~ `test-shell.md`

ACKs for top commit:
  jamesob:
    ACK 19139ee034
  jonatack:
    ACK 19139ee034d20ebab1b91d3ac13a8eee70b59374
  jnewbery:
    Rather than invalidate the three ACKs for a minor nit, can you force push back to 19139ee034d20ebab1b91d3ac13a8eee70b59374 please? I think this PR was ready to merge before your last force push.
  jachiang:
    > Rather than invalidate the three ACKs for a minor nit, can you force push back to [19139ee](19139ee034) please? I think this PR was ready to merge before your last force push.
  jnewbery:
    ACK 19139ee034d20ebab1b91d3ac13a8eee70b59374

Tree-SHA512: 0c24f405f295a8580a9c8f1b9e0182b5d753eb08cc331424616dd50a062fb773d3719db4d08943365b1f42ccb965cc363b4bcc5beae27ac90b3460b349ed46b2
2022-09-07 21:45:31 +03:00
MarcoFalke
9e41907692
Merge #16042: test: Bump MAX_NODES to 12
fa47330397 test: Speed up cache creation (MarcoFalke)
fa6ad7a5ec test: Bump MAX_NODES to 12 (MarcoFalke)

Pull request description:

  When testing a combination of settings that affect the datadir (e.g. prune, blockfilter, ...) we may need a lot of datadirs.
  Bump the maximum number of nodes proactively from 8 to 12, so that caches get populated with 12 node dirs, as opposed to 8.

  Also, add an assert that the list of deterministic keys is exactly the number of max nodes (and not more than that.

  Also, create the cache faster.

ACKs for commit fa4733:
  laanwj:
    utACK fa473303972b7dad600d949dc9b303d8136cb7e7

Tree-SHA512: 9803c765ed52d344102f5a3bce57b05d88a7429dcb05ed66ed6c881fda8d87c2834d02d21b95fe9f39c0efe3b8527e13cf94f006588cde22e8c2cd50b2d517a6
2022-09-07 20:15:52 +03:00
MarcoFalke
5524c42b8c
Merge #15419: qa: Always refresh cache to be out of ibd
fa2cdc9ac2 test: Simplify create_cache (MarcoFalke)
fa25210d62 qa: Fix wallet_txn_doublespend issue (MarcoFalke)
1111aecbb5 qa: Always refresh stale cache to be out of ibd (MarcoFalke)
fab0d85802 qa: Remove mocktime unless required (MarcoFalke)

Pull request description:

  When starting a test, we are always in IBD because the timestamps on cached blocks are in the past. Usually, we solve that by generating a block at the beginning of the test.

  That is clumsy and might even lead to other problems such as #15360 and https://github.com/bitcoin/bitcoin/issues/14446#issuecomment-461926598

  So fix that by getting rid of mocktime and always refreshing the last block of the cache when starting the test framework.

  Should fix #14446

Tree-SHA512: 6af09800f9c86131349a103af617a54551f5f3f3260d38e14e3f30fdd3d91a0feb0100c56cbb12eae4aeac5571ae4b530b16345cbb831d2670237b53351a22c1
2022-09-07 20:15:43 +03:00
UdjinM6
44fda52d68
Merge pull request #4925 from PastaPastaPasta/develop-trivial-2022-07-17
backport: trivial backports
2022-09-06 20:35:53 +03:00
PastaPastaPasta
0f3e00ce03
refactor: create an enum for DKGError, instead of passing around potentially invalid strings (#4998)
* refactor: create an enum for DKGError, instead of passing around potentially invalid strings

This also enables us to utilize an std::array instead of a std::map
This also removes the CCriticalSection and instead utilizes atomic doubles
This also adds safety to the dkgsimerror rpc rejecting invalid types

* test: add some tests for DKGError
2022-09-06 20:32:53 +03:00
fanquake
7f0bdbda11
Merge bitcoin/bitcoin#24298: fuzz: Avoid unsigned integer overflow in FormatParagraph
fa2f7d005932bff9b7d27744ae517b9e7910df8d fuzz: Avoid unsigned integer overflow in FormatParagraph (MarcoFalke)

Pull request description:

  `FormatParagraph` is only ever called with compile time constant arguments, so I don't see the need for fuzzing it.

  Though, keep it for now, but avoid the unsigned integer overflow with this patch.

ACKs for top commit:
  laanwj:
    Code review ACK fa2f7d005932bff9b7d27744ae517b9e7910df8d

Tree-SHA512: 01fc64a9ef73c183921ca1b0cd8db9514c0a242e3acf215a3393f383ae129e01625ebb16eaf9cb86370eda62d0145c3dcf8f62e40edf5958abc1f777c5687280
2022-09-03 10:43:16 -05:00