aboutsummaryrefslogtreecommitdiff
path: root/test/functional/wallet_keypool.py
AgeCommit message (Collapse)Author
2024-07-16scripted-diff: Add `__file__` argument to `BitcoinTestFramework.init()`Hennadii Stepanov
-BEGIN VERIFY SCRIPT- sed -i -e 's/\s*().main\s*()/(__file__).main()/' $(git ls-files test/functional/*.py) sed -i -e 's/def __init__(self)/def __init__(self, test_file)/' test/functional/test_framework/test_framework.py -END VERIFY SCRIPT-
2024-02-28test: make sure keypool sizes do not change on ↵UdjinM6
`getrawchangeaddress`/`getnewaddress` failures
2023-10-10test: Add Wallet Unlock Context ManagerBrandon Odiwuor
Add Context Manager to manage wallet locking/unlocking with passphrase
2023-10-05test: Bump walletpassphrase timeouts to avoid intermittent issuesMarcoFalke
2023-05-03test: Update python tests to use named parameters instead of options objectsRyan Ofsky
2022-12-24scripted-diff: Bump copyright headersHennadii Stepanov
-BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./ -END VERIFY SCRIPT- Commits of previous years: - 2021: f47dda2c58b5d8d623e0e7ff4e74bc352dfa83d7 - 2020: fa0074e2d82928016a43ca408717154a1c70a4db - 2019: aaaaad6ac95b402fe18d019d67897ced6b316ee0
2022-12-18test: call `keypoolrefill` with private keys disabled should throw an errorbrunoerg
2022-11-10test: Remove wallet option from non-wallet testsMacroFake
Review note: The changes are complete, because self.options.descriptors is set to None in parse_args (test_framework.py). A value of None implies -disablewallet, see the previous commit. So if a call to add_wallet_options is missing, it will lead to a test failure when the wallet is compiled in.
2021-11-16Create a tr() descriptor bech32m DescriptorScriptPubKeyMan by defaultAndrew Chow
2021-11-10scripted-diff: Bump copyright headersMarcoFalke
The previous diff touched most files in ./test/, so bump the headers to avoid having to touch them again for a bump later. -BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./test/ -END VERIFY SCRIPT-
2021-11-05Merge bitcoin/bitcoin#22949: fee: Round up fee calculation to avoid a lower ↵Samuel Dobson
than expected feerate 80dc829be7f8c3914074b85bb4c125baba18cb2c tests: Calculate fees more similarly to CFeeRate::GetFee (Andrew Chow) ce2cc44afd51f3df4ee7f14ea05b8da229183923 tests: Test for assertion when feerate is rounded down (Andrew Chow) 0fbaef9676a1dcb84bcf95afd8d994831ab327b6 fees: Always round up fee calculated from a feerate (Andrew Chow) Pull request description: When calculating the fee for a feerate, it is possible that the final calculation will have fractional satoshis. Currently those are ignored via truncation which results in the absolute fee being rounded down. Rounding down is problematic because it results in a feerate that is slightly lower than the feerate represented by the `CFeeRate` object. A slightly lower feerate particularly causes issues for coin selection as it can trigger an assertion error. To avoid potentially underpaying the feerate (and the assertion), always round up the calculated fee. A test is added for the assertion, along with a comment explaining what happens. It is unlikely that a user can trigger this as it requires a very specific set of rounding errors to occur as well as the transaction not needing any change and being right on the lower bound of the exact match window. However I was able to trigger the assertion while running coin selection simulations, albeit after thousands of transactions and with some weird feerates. ACKs for top commit: ryanofsky: Code review ACK 80dc829be7f8c3914074b85bb4c125baba18cb2c promag: Tested ACK 80dc829be7f8c3914074b85bb4c125baba18cb2c. lsilva01: tACK 80dc829 meshcollider: utACK 80dc829be7f8c3914074b85bb4c125baba18cb2c Tree-SHA512: fe26684c60f236cab48ea6a4600c141ce766dbe59504ec77595dcbd7fd0b34559acc617007f4f499c9155d8fda0a336954413410ba862b19c765c0cfac79d642
2021-10-14test: Add check that newkeypool flushes change addresses tooSamuel Dobson
2021-10-08fees: Always round up fee calculated from a feerateAndrew Chow
When calculating the fee for a given tx size from a fee rate, we should always round up to the next satoshi. Otherwise, if we round down (via truncation), the calculated fee may result in a fee with a feerate slightly less than targeted. This is particularly important for coin selection as a slightly lower feerate than expected can result in a variety of issues.
2021-09-26Add test for flushing keypool with newkeypoolSamuel Dobson
2021-09-02scripted-diff: Use generate* from TestFrameworkMarcoFalke
-BEGIN VERIFY SCRIPT- sed --regexp-extended -i \ 's/((self\.)?(nodes\[[^]]+\]|[a-z_]*(wallet|node)[0-9a-z_]*))\.(generate(|toaddress|block|todescriptor)(\(|, ))/self.\5\1, /g' \ $(git grep -l generate ./test | grep -v 'test_framework/' | grep -v 'feature_rbf') -END VERIFY SCRIPT-
2021-06-22wallet: Add error message to GetReservedDestinationAndrew Chow
Adds an error output parameter to all GetReservedDestination functions so that callers can get the actual reason that a change address could not be fetched. This more closely matches GetNewDestination. This allows for more granular error messages, such as one that indicates that bech32m addresses cannot be generated yet.
2020-12-31scripted-diff: Bump copyright headersMarcoFalke
-BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./ -END VERIFY SCRIPT-
2020-09-29test, refactor: add default_wallet_name and wallet_data_filename variablesRussell Yanofsky
No changes in behavior
2020-04-23Add a --descriptors option to various testsAndrew Chow
Adds a --descriptors option globally to the test framework. This will make the test create and use descriptor wallets. However some tests may not work with this. Some tests are modified to work with --descriptors and run with that option in test_runer: * wallet_basic.py * wallet_encryption.py * wallet_keypool.py * wallet_keypool_topup.py * wallet_labels.py * wallet_avoidreuse.py
2020-02-04[wallet] allow transaction without change if keypool is emptySjors Provoost
2019-03-02scripted-diff: Update copyright in ./testMarcoFalke
-BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./test/ -END VERIFY SCRIPT-
2019-03-02scripted-diff: test: Remove brackets after assertMarcoFalke
-BEGIN VERIFY SCRIPT- sed -i --regexp-extended -e 's/assert ?\((.+)\)(( )*)?(#.*)?$/assert \1\3\3\4/g' $(git grep -l --extended-regexp 'assert ?\(' test) -END VERIFY SCRIPT-
2019-02-14Remove hdmasterkeyidAndrew Chow
2018-10-16[tests] Small fixups before deprecating generateJohn Newbery
In advance of deprecating the generate RPC method, make some small changes to a small number of inidividual test cases: - make memory checking less prescriptive in wallet_basic.py - replace calls to generate with generatetoaddress in wallet_keypool.py - replace calls to generate with generatetoaddress and fixup label issues in wallet_labels.py - replace calls to generate with generatetoaddress in wallet_multiwallet.py
2018-09-14Merge #12493: [wallet] Reopen CDBEnv after encryption instead of shutting downWladimir J. van der Laan
c1dde3a949b36ce9c2155777b3fa1372e7ed97d8 No longer shutdown after encrypting the wallet (Andrew Chow) d7637c5a3f1d62922594cdfb6272e30dacf60ce9 After encrypting the wallet, reload the database environment (Andrew Chow) 5d296ac810755dc47f105eb95b52b7e2bcb8aea8 Add function to close all Db's and reload the databae environment (Andrew Chow) a769461d5e37ddcb771ae836254fdc69177a28c4 Move BerkeleyEnvironment deletion from internal method to callsite (Andrew Chow) Pull request description: This is the replacement for #11678 which implements @ryanofsky's [suggestion](https://github.com/bitcoin/bitcoin/pull/11678#pullrequestreview-76464511). Shutting down the software was to prevent the BDB environment from writing unencrypted private keys to disk in the database log files, as was noted [here](https://bitcointalk.org/index.php?topic=51474.msg616068#msg616068). This PR replaces the shutdown behavior with a CDBEnv flush, close, and reopen which achieves the same effect: everything is cleanly flushed and closed, the log files are removed, and then the environment reopened to continue normal operation. To ensure that no unencrypted private keys are in the log files after encrypting the wallet, I wrote [this script](https://gist.github.com/achow101/7f7143e6c3d3fdc034d3470e72823e9d) to pull private keys from the original wallet file and searches for these keys in the log files (note that you will have to change your file paths to make it work on your own machine). As for concerns about private keys being written to slack space or being kept in memory, these behaviors no longer exist after the original wallet encryption PR and the shutting down solution from 2011. cc @ryanofsky Tree-SHA512: 34b894283b0677a873d06dee46dff8424dec85a2973009ac9b84bcf3d22d05f227c494168c395219d9aee3178e420cf70d4b3eeacc9785aa86b6015d25758e75
2018-09-10qa: Run all tests even if wallet is not compiledMarcoFalke
2018-08-13tests: Use explicit importspracticalswift
2018-08-09No longer shutdown after encrypting the walletAndrew Chow
Since the database environment is flushed, closed, and reopened during EncryptWallet, there is no need to shut down the software anymore.
2018-07-27Update copyright headers to 2018DrahtBot
2018-05-19[rpc] [wallet] Add 'hdmasterkeyid' alias return values.John Newbery
Restores the return value in getwalletinfo() and getaddressinfo() RPC methods for backwards compatibility
2018-05-19scripted-diff: Rename master key to seedJohn Newbery
-BEGIN VERIFY SCRIPT- ren() { git grep -l "\<$1\>" 'src/*.cpp' 'src/*.h' test | xargs sed -i "s:\<$1\>:$2:g"; } ren GenerateNewHDMasterKey GenerateNewSeed ren DeriveNewMasterHDKey DeriveNewSeed ren SetHDMasterKey SetHDSeed ren hdMasterKeyID hd_seed_id ren masterKeyID seed_id ren SetMaster SetSeed ren hdmasterkeyid hdseedid ren hdmaster hdseed -END VERIFY SCRIPT-
2018-04-16Minor Python cleanups to make flake8 pass with the new rules enabledpracticalswift
2018-02-16scripted-diff: validateaddress to getaddressinfo in testsAndrew Chow
Change all instances of validateaddress to getaddressinfo since it seems that no test actually uses validateaddress for actually validating addresses. -BEGIN VERIFY SCRIPT- find ./test/functional -path '*py' -not -path ./test/functional/wallet_disable.py -not -path ./test/functional/rpc_deprecated.py -not -path ./test/functional/wallet_address_types.py -exec sed -i'' -e 's/validateaddress/getaddressinfo/g' {} \; -END VERIFY SCRIPT-
2018-01-25[tests] Rename wallet_* functional tests.Anthony Towns