Commit graph

181 commits

Author SHA1 Message Date
Pablo Greco
85c3c2b819 Deprecate con_dyna_deploy_start in favor of evbparams 2021-11-23 14:36:03 +00:00
Andrew Chow
d8fa5c1458 Use createtx array outputs 2021-06-22 14:42:19 -04:00
Andrew Poelstra
2573747447 fix test code duplication from 3a0de44d90 2021-04-15 17:06:37 +00:00
Andrew Poelstra
29c7f63764 Merge c48e788246 into merged_master (Bitcoin PR #18836) 2020-12-02 15:51:02 +00:00
Andrew Poelstra
6f267e338a Merge 47fc883106 into merged_master (Bitcoin PR #19967) 2020-12-01 14:36:58 +00:00
Andrew Poelstra
251361078d Merge 80c8a02f1b into merged_master (Bitcoin PR #20159) 2020-12-01 05:47:16 +00:00
Andrew Poelstra
f5f5be3203 Merge 136fe4c5e9 into merged_master (Bitcoin PR #19816) 2020-11-28 21:25:31 +00:00
Andrew Poelstra
ef13698934 Merge 48c1083632 into merged_master (Bitcoin PR #19105) 2020-11-28 20:18:13 +00:00
Andrew Poelstra
f4b291f821 Merge 28f4e53e16 into merged_master (Bitcoin PR #19752) 2020-11-28 14:17:23 +00:00
Andrew Poelstra
c98788b086 Merge cb1ee1551c into merged_master (Bitcoin PR #19674) 2020-11-27 14:17:51 +00:00
Andrew Poelstra
714f585800 Merge 4b5c9191e3 into merged_master (Bitcoin PR #19208) 2020-11-26 01:09:11 +00:00
Andrew Poelstra
9fdbb98aff Merge 5cafb46fef into merged_master (Bitcoin PR #19294) 2020-11-26 01:09:06 +00:00
Andrew Poelstra
89ca8ea199 Merge b3ec1fe811 into merged_master (Bitcoin PR #18890) 2020-11-26 01:09:01 +00:00
Andrew Poelstra
dccd3297b0 Merge 362f9c60a5 into merged_master (Bitcoin PR #18986) 2020-11-26 01:08:45 +00:00
Andrew Poelstra
34d072006e Merge 376294cde6 into merged_master (Bitcoin PR #18866) 2020-11-26 01:08:40 +00:00
Andrew Poelstra
c0fda0cc05 Merge ddc0a600b3 into merged_master (Bitcoin PR #18617)
For reasons I do not really grok, this PR changes the timing behavior of the
functional tests to reliably expose a deadlock in the claimpegin RPC that has
existed since the 0.17 rebase.

The mechanism is: in `claimpegin` in src/wallet/rpcwallet.cpp:5873, we call
`AcceptToMemoryPoolWorker`. This requires cs_main to be locked, which it is
not (contrast Core's `testmempoolaccept` RPC, which similarly calls
`AcceptToMemoryPoolWorker` from the RPC thread, and locks cs_main immediately
before).

We do *say* that it is locked, in the `LockAssertion` one the line above, but
this was added in ad3d496d78 during the 0.17
rebase (PR #620), apparently to shut up some linter on OSX, and as near as I
can tell it was never true.

Anyway, `AcceptToMemoryPoolWorker` calls through a couple layers which assume
cs_main is locked, to `AcceptSingleTransaction`, which locks m_pool.cs on line
src/validation.cpp:1101. It then calls `PreChecks`, which on line 784 calls
::ChainActive(), which _actually_ locks cs_main, though only briefly. This
line is the deadlock, because we locked m_pool.cs followed by cs_main...

...meanwhile, in src/net_processing.cpp, we lock cs_main at the top of the
`PeerLogicValidation::SendMessages` loop (src/net_processing.cpp:3628). In the
same loop, in the `feefilter` message processing, we call CTxMemPool::GetMinFee
(src/net_processing.cpp:4137), which locks m_pool.cs. Deadlock.

Anyway, that explains the change to locking behavior that I added to an
otherwise test-only PR.
2020-11-26 01:08:36 +00:00
Andrew Poelstra
733d5cf974 Merge e302830fae into merged_master (Bitcoin PR #18774) 2020-11-26 01:08:33 +00:00
Andrew Poelstra
e234a42a47 Merge 9ea4d8326a into merged_master (Bitcoin PR #18704) 2020-11-26 01:08:26 +00:00
Andrew Poelstra
fd37b7c5d6 Merge 54f812d9d2 into merged_master (Bitcoin PR #18673) 2020-11-26 01:08:23 +00:00
Andrew Poelstra
15d1e10a14 Merge d2db25233c into merged_master (Bitcoin PR #18474) 2020-11-26 01:08:06 +00:00
Wladimir J. van der Laan
c48e788246
Merge #18836: wallet: upgradewallet fixes and additional tests
5f9c0b6360 wallet: Remove -upgradewallet from dummywallet (MarcoFalke)
a314271f08 test: Remove unused wallet.dat (MarcoFalke)
bf7635963c tests: Test specific upgradewallet scenarios and that upgrades work (Andrew Chow)
4b418a9dec test: Add test_framework/bdb.py module for inspecting bdb files (Andrew Chow)
092fc43485 tests: Add a sha256sum_file function to util (Andrew Chow)
0bd995aa19 wallet: upgrade the CHDChain version number when upgrading to split hd (Andrew Chow)
8e32e1c41c wallet: remove nWalletMaxVersion (Andrew Chow)
bd7398cc62 wallet: have ScriptPubKeyMan::Upgrade check against the new version (Andrew Chow)
5f720544f3 wallet: Add GetClosestWalletFeature function (Andrew Chow)
842ae3842d wallet: Add utility method for CanSupportFeature (Andrew Chow)

Pull request description:

  This PR cleans up the wallet upgrade mechanism a bit, fixes some probably bugs, and adds more test cases.

  The `nWalletMaxVersion` member variable has been removed as it made `CanSupportFeature` unintuitive and was causing a couple of bugs. The reason this was introduced originally was to allow a wallet upgrade to only occur when the new feature is first used. While this makes sense for the old `-upgradewallet` option, for an RPC, this does not quite make sense. It's more intuitive for an upgrade to occur if possible if the `upgradewallet` RPC is used as that's an explicit request to upgrade a particular wallet to a newer version. `nWalletMaxVersion` was only relevant for upgrades to `FEATURE_WALLETCRYPT` and `FEATURE_COMPRPUBKEY` both of which are incredibly old features. So for such wallets, the behavior of `upgradewallet` will be that the feature is enabled immediately without the wallet needing to be encrypted at that time (note that `FEATURE_WALLETCRYPT` indicates support for encryption, not that the wallet is encrypted) or for a new key to be generated.

  `CanSupportFeature` would previously indicate whether we could upgrade to `nWalletMaxVersion` not just whether the current wallet version supported a feature. While this property was being used to determine whether we should upgrade to HD and HD chain split, it was also causing a few bugs. Determining whether we should upgrade to HD or HD chain split is resolved by passing into `ScriptPubKeyMan::Upgrade` the version we are upgrading to and checking against that. By removing `nWalletMaxVersion` we also fix a bug where you could upgrade to HD chain split without the pre-split keypool.

  `nWalletMaxVersion` was also the version that was being reported by `getwalletinfo` which meant that the version reported was not always consistent across restarts as it depended on whether `upgradewallet` was used. Additionally to make the wallet versions consistent with actually supported versions, instead of just setting the wallet version to whatever is given to `upgradewallet`, we normalize the version number to the closest supported version number. For example, if given 150000, we would store and report 139900.

  Another bug where CHDChain was not being upgraded to the version supporting HD chain split is also fixed by this PR.

  Lastly several more tests have been added. Some refactoring to the test was made to make these tests easier. These tests check specific upgrading scenarios, such as from non-HD (version 60000) to HD to pre-split keypool. Although not specifically related to `upgradewallet`, `UpgradeKeyMetadata` is now being tested too.

  Part of the new tests is checking that the wallet files are identical before and after failed upgrades. To facilitate this, a utility function `sha256sum_file` has been added. Another part of the tests is to examine the wallet file itself to ensure that the records in the wallet.dat file have been correctly modified. So a new `bdb.py` module has been added to deserialize the BDB db of the wallet.dat file. This format isn't explicitly documented anywhere, but the code and comments in BDB's source code in file `dbinc/db_page.h` describe it. This module just dumps all of the fields into a dict.

ACKs for top commit:
  MarcoFalke:
    approach ACK 5f9c0b6360
  laanwj:
    Code review ACK 5f9c0b6360
  jonatack:
    ACK 5f9c0b6360, approach seems fine, code review, only skimmed the test changes but they look well done, rebased on current master, debug built and verified the `wallet_upgradewallet.py` test runs green both before and after running `test/get_previous_releases.py -b v0.19.1 v0.18.1 v0.17.2 v0.16.3 v0.15.2`

Tree-SHA512: 7c4ebf420850d596a586cb6dd7f2ef39c6477847d12d105fcd362abb07f2a8aa4f7afc5bfd36cbc8b8c72fcdd1de8d2d3f16ad8e8ba736b6f4f31f133fe5feba
2020-11-16 11:03:25 +01:00
Andrew Poelstra
7187ea2de7 Merge 3f1966ead6 into merged_master (Bitcoin PR #17705) 2020-11-14 16:51:57 +00:00
Andrew Poelstra
a19375575a Merge 222b7d0ca7 into merged_master (Bitcoin PR #17330) 2020-11-09 21:20:49 +00:00
Andrew Poelstra
4f50591181 Merge 0d2832a6d1 into merged_master (Elements PR #741)
To resolve the `ConstructTransaction` conflict I reverted to the existing code
then manually applied the diff (it adds a parameter then adds a giant pile of
code to the input loop).
2020-11-09 21:20:40 +00:00
Andrew Poelstra
6823c31c7c Merge d6f304a462 into merged_master (Elements PR #684)
This PR reduced the minrelayfee for Elements, but also brought in some
changes from upstream which I mostly just didn't take (since we've
already brought them in, in earlier parts of this rebase).
2020-11-09 21:20:39 +00:00
Andrew Poelstra
e73c3f2c3f Merge 866fd2888f into merged_master (Bitcoin PR #17030) 2020-11-09 21:20:34 +00:00
Andrew Poelstra
0fbbfe35c3 Merge a689c11907 into merged_master (Bitcoin PR #16524) 2020-11-09 21:20:33 +00:00
Andrew Poelstra
eab90a6495 Merge 13377b7a69 into merged_master (Bitcoin PR #16918) 2020-11-09 21:20:27 +00:00
Andrew Poelstra
98c5244de1 Merge a73775e4d5 into merged_master (Bitcoin PR #16917) 2020-11-09 21:20:27 +00:00
Andrew Poelstra
b24be4b1a7 Merge 59c138d2f1 into merged_master (Bitcoin PR #16898) 2020-11-09 21:20:27 +00:00
Andrew Poelstra
e413b2ebbb Merge ca97d292ce into merged_master (Bitcoin PR #16551) 2020-11-09 21:20:24 +00:00
Andrew Poelstra
8fa52e84b0 Merge 8af835a72d into merged_master (Bitcoin PR #16796) 2020-11-09 21:20:23 +00:00
Andrew Poelstra
9cc26a716a Merge 5b2fe5563b into merged_master (Elements PR #642)
FIXME: we disable standardness checks for the non-PAK node in the PAK tests.
This is because of a bug in Elements which causes non-PAK nodes to reject
pegouts for standardness reasons. Need to fix it after the rebase.
2020-11-09 21:20:21 +00:00
Andrew Poelstra
e62e563c84 Merge 27ee0cc5a6 into merged_master (Bitcoin PR #16646) 2020-11-09 21:20:16 +00:00
Andrew Poelstra
5f280a6068 Merge 1bf2ff2bf8 into merged_master (Bitcoin PR #16060) 2020-11-09 21:20:15 +00:00
Andrew Poelstra
0d445414a6 Merge 05ccbe9a29 into merged_master (Bitcoin PR #16598) 2020-11-09 21:20:13 +00:00
Andrew Poelstra
a93a689a14 Merge d5ea8f4bf3 into merged_master (Bitcoin PR #16509) 2020-11-09 21:20:12 +00:00
Andrew Poelstra
62ce823f8f Merge c67ef2938c into merged_master (Elements PR #600)
Also uncommented a bunch of PSBT functional tests (had to add a fee output
to one transaction, update `find_output` to skip CT outputs, and change two
constant checks at the end of the commented-out section).
2020-11-09 21:20:10 +00:00
Andrew Poelstra
3a0de44d90 Merge 0822b44d8a into merged_master (Bitcoin PR #15282) 2020-11-09 21:20:06 +00:00
Andrew Poelstra
bbc59975b0 Merge 4858d36163 into merged_master (Elements PR #639) 2020-11-06 15:20:11 +00:00
Andrew Chow
092fc43485 tests: Add a sha256sum_file function to util 2020-11-04 12:15:25 -05:00
Andrew Poelstra
0eedc2c45b Merge 63b9efa73d into merged_master (Bitcoin PR #16042) 2020-10-29 22:39:10 +00:00
Andrew Poelstra
b8e90ed29c Merge df7addc4c6 into merged_master (Bitcoin PR #15990) 2020-10-29 18:38:42 +00:00
Andrew Poelstra
8b4b800d49 Merge f9f6c11a74 into merged_master (Bitcoin PR #15771) 2020-10-28 02:12:01 +00:00
Andrew Poelstra
7d93f137a0 Merge c033c4b5ce into merged_master (Bitcoin PR #13541) 2020-10-28 00:09:04 +00:00
Andrew Poelstra
67d718b048 Merge a74d588f21 into merged_master (Bitcoin PR #14954) 2020-10-27 22:32:24 +00:00
Elliott Jin
3c7d9ab8c8 test: Move (dis)?connect_nodes globals into TestFramework as helpers 2020-10-20 00:43:00 -07:00
Sebastian Falbesoner
8ee3536b2b test: remove unused helpers random_transaction(), make_change() and gather_inputs() 2020-10-16 15:40:54 +02:00
fanquake
136fe4c5e9
Merge #19816: test: Rename wait until helper to wait_until_helper
fa1cd9e1dd test: Remove unused lock arg from BitcoinTestFramework.wait_until (MarcoFalke)
fad2794e93 test: Rename wait until helper to wait_until_helper (MarcoFalke)
facb41bf1d test: Remove unused p2p_lock in VersionBitsWarningTest (MarcoFalke)

Pull request description:

  This avoids confusion with the `wait_until` member functions, which should be preferred because they take the appropriate locks and scale the timeout appropriately on their own.

ACKs for top commit:
  laanwj:
    Code review ACK fa1cd9e1dd
  hebasto:
    ACK fa1cd9e1dd, I have reviewed the code and it looks OK, I agree it can be merged.

Tree-SHA512: 319d400085606a4c738e314824037f72998e6657d8622b363726842aba968744f23c56d27275dfe506b8cbbb6e97fc39ca1d325db05d4d67df0e8b35f2244d5c
2020-09-03 12:07:53 +08:00
Wladimir J. van der Laan
48c1083632
Merge #19105: Add Muhash3072 implementation in Python
36ec9801a4 test: Add chacha20 test vectors in muhash (Fabian Jahr)
0e2b400fea test: Add basic Python/C++ Muhash implementation parity unit test (Fabian Jahr)
b85543cb73 test: Add Python MuHash3072 implementation to test framework (Pieter Wuille)
ab30cece0e test: Move modinv to util and add unit test (Fabian Jahr)

Pull request description:

  This is the second in a [series of pull requests](https://github.com/bitcoin/bitcoin/pull/18000) to implement an Index for UTXO set statistics.

  This pull request adds a Python implementation of Muhash3072, a homomorphic hashing algorithm to be used for hashing the UTXO set. The Python implementation can then be used to compare behavior with the C++ version.

ACKs for top commit:
  jnewbery:
    utACK 36ec9801a
  laanwj:
    Code review ACK 36ec9801a4

Tree-SHA512: a3519c6e11031174f1ae71ecd8bcc7f3be42d7fc9c84c77f2fbea7cfc5ad54fcbe10b55116ad8d9a52ac5d675640eefed3bf260c58a02f2bf3bc0d8ec208baa6
2020-09-01 17:12:20 +02:00