Commit graph

195 commits

Author SHA1 Message Date
Andrew Poelstra
be04e946b9 Merge 964d91b193 into merged_master (Bitcoin PR bitcoin/bitcoin#22130) 2021-07-25 15:24:50 +00:00
Andrew Poelstra
f806c13661 Merge 260b1d74fe into merged_master (Bitcoin PR bitcoin/bitcoin#22092) 2021-07-22 18:31:32 +00:00
Andrew Poelstra
b945a1dacf Merge a1f0b8b62e into merged_master (Bitcoin PR #21634) 2021-06-30 12:41:09 +00:00
Andrew Poelstra
d39d57c704 Merge 1c7be9ab90 into merged_master (Bitcoin PR #20286)
I hate this PR.
2021-06-28 21:30:17 +00:00
Andrew Poelstra
ac89deaff7 Merge c0e44ee8e4 into merged_master (Bitcoin PR #21254) 2021-06-25 15:52:53 +00:00
Andrew Poelstra
a9ab76769e Merge 11cbd4bb54 into merged_master (Bitcoin PR #17556)
This PR eliminates "strange regtest=0 behavior" in a test which had forced
us to disable the test for Elements. Can re-enable now :)

I also removed the `chain_in_args` parameter to `TestNode`, which Steven added
in https://github.com/ElementsProject/elements/pull/533 (which itself replaces
unconditionally adding chain={} on the command-line, which was added in #458).
These were added in the 0.17 rebase to deal with the job of starting bitcoind,
which then did not support the `chain=` command-line arg as well as elementsd,
which back then required this command-line arg.

This was causing some issues with the "check -acceptnonstdtxn doesn't work on
mainnet" test because it would add -chain=elementsregtest to the command-line
of a daemon that was supposed to be connecting to mainnet/liquidv1. It is
possible to override this behavior, but since 0.20+ versions of elementsd and
bitcoind have essentially the same support for chain= options, it seemed
cleaner to just eliminate the diff.
2021-06-18 14:40:09 +00:00
Andrew Poelstra
c5a022192f Merge d7e2401c62 into merged_master (Bitcoin PR #18077) 2021-06-17 01:59:15 +00:00
Sebastian Falbesoner
01eedf3821 test: doc: improve doc for chain_transaction() helper
Change to docstring format and describe the functions
purpose, its parameters and return value in more detail.
2021-06-08 00:21:37 +02:00
Sebastian Falbesoner
6e63e366d6 test: refactor: dedup utility function chain_transaction() 2021-06-08 00:21:37 +02:00
fanquake
b043ca8e8b
test: convert docs into type annotations in test_framework/util.py 2021-06-03 20:45:03 +08:00
Andrew Poelstra
2573747447 fix test code duplication from 3a0de44d90 2021-04-15 17:06:37 +00:00
Andrew Chow
41f891da50 tests: Skip SQLite fsyncs while testing
Since we want tests to run quickly, and since tests do a lot more db
operations than expected we expect to see in actual usage, we disable
sqlite's syncing behavior to make db operations run much faster. This
syncing behavior is necessary for normal operation as it helps guarantee
that data won't become lost or corrupted, but in tests, we don't care
about that.
2021-04-12 19:29:03 -04:00
Michael Dietz
085b3a7299
rpc: deprecate addresses and reqSigs from rpc outputs
1) add a new sane "address" field (for outputs that have an
   identifiable address, which doesn't include bare multisig)
2) with -deprecatedrpc: leave "reqSigs" and "addresses" intact
   (with all weird/wrong behavior they have now)
3) without -deprecatedrpc: drop "reqSigs" and "addresses" entirely,
   always.
2021-03-23 10:51:43 -04:00
MarcoFalke
fa730e9157
test: Avoid connecting to real network when running tests
Can be reviewed with --word-diff-regex=.
2021-02-21 11:02:58 +01:00
MarcoFalke
11cbd4bb54
Merge #17556: test: Change feature_config_args.py not to rely on strange regtest=0 behavior
ff44cae279 test: Change feature_config_args.py not to rely on strange regtest=0 behavior (Russell Yanofsky)

Pull request description:

  Update test to simply generate a normal mainnet configuration file instead of using a crazy setup where a regtest=1 config file using an includeconf in the [regtest] section includes another config file that specifies regtest=0, retroactively switching the network to mainnet.

  This setup was fragile and only worked because the triggered InitError happened early enough that none of the ignored [regtest] options mattered (only affecting log output).

  This change was originally made as part of #17493

Top commit has no ACKs.

Tree-SHA512: 3f77305454f04438493dfc2abd78a00434b30869454d1c3f54587b9c1f63239c49c90fb3b4d3a777ad130f2184e0f2dac87cee4cd23c50f1b3496a375943da01
2021-01-21 16:51:19 +01:00
Hennadii Stepanov
a39f7336a3
net: Add -natpmp command line option 2021-01-07 18:07:09 +02: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