aboutsummaryrefslogtreecommitdiff
path: root/test/functional
AgeCommit message (Collapse)Author
2021-07-16Test that descriptor wallet upgrade does nothingAndrew Chow
2021-07-15Merge bitcoin/bitcoin#22211: net: relay I2P addresses even if not reachable ↵W. J. van der Laan
(by us) 7593b06bd1262f438bf34769ecc00e9c22328e56 test: ensure I2P addresses are relayed (Vasil Dimov) e7468139a1dddd4946bc70697ec38816b3fa8f9b test: make CAddress in functional tests comparable (Vasil Dimov) 33e211d2a442e4555ff3401f92af4ee2f7552568 test: implement ser/unser of I2P addresses in functional tests (Vasil Dimov) 86742811ce3662789ac85334008090a3b54babe3 test: use NODE_* constants instead of magic numbers (Vasil Dimov) ba45f0270815d54ae3290efc16324c2ff1984565 net: relay I2P addresses even if not reachable (by us) (Vasil Dimov) Pull request description: Nodes that can reach the I2P network (have set `-i2psam=`) will relay I2P addresses even without this patch. However, nodes that can't reach the I2P network will not. This was done as a precaution in https://github.com/bitcoin/bitcoin/pull/20119 before anybody could connect to I2P because then, for sure, it would have been useless. Now, however, we have I2P support and a bunch of I2P nodes, so get all nodes on the network to relay I2P addresses to help with propagation, similarly to what we do with Tor addresses. ACKs for top commit: jonatack: ACK 7593b06bd1262f438bf34769ecc00e9c22328e56 naumenkogs: ACK 7593b06bd1262f438bf34769ecc00e9c22328e56. laanwj: Code review ACK 7593b06bd1262f438bf34769ecc00e9c22328e56 kristapsk: ACK 7593b06bd1262f438bf34769ecc00e9c22328e56. Code looks correct, tested that functional test suite passes and also that `test/functional/p2p_addrv2_replay.py` fails if I undo changes in `IsRelayable()`. Tree-SHA512: c9feec4a9546cc06bc2fec6d74f999a3c0abd3d15b7c421c21fcf2d610eb94611489e33d61bdcd5a4f42041a6d84aa892f7ae293b0d4f755309a8560b113b735
2021-07-15Merge bitcoin/bitcoin#22447: test: whitelist rpc_rawtransaction peers to ↵fanquake
speed up tests a3d6ec5bb567481a634638cea7ae37c355119a7b test: move rpc_rawtransaction tests to < 30s group (Jon Atack) 5a1ed96077852c739034c21d399da65db09e7714 test: whitelist rpc_rawtransaction peers to speed up tests (Jon Atack) Pull request description: Speed up the somewhat slow `rpc_rawtransaction.py` test by more than 3x (from 45-55 seconds to 15 seconds on a laptop running 2 x 2.5GHz). ACKs for top commit: mjdietzx: ACK a3d6ec5bb567481a634638cea7ae37c355119a7b kristapsk: ACK a3d6ec5bb567481a634638cea7ae37c355119a7b theStack: ACK a3d6ec5bb567481a634638cea7ae37c355119a7b 🐎 brunoerg: tACK a3d6ec5bb567481a634638cea7ae37c355119a7b Tree-SHA512: f1d105594c9b5b257a7096b631a6fa5aeb50e330a351f75c2d6ffa7dd73abdb6e1f596a78c16d204a9bac3fe506e0519f9ad96bb8477ab6424c8e18125ccb659
2021-07-14test: move rpc_rawtransaction tests to < 30s groupJon Atack
2021-07-14test: whitelist rpc_rawtransaction peers to speed up testsJon Atack
in my testing from 45-55 seconds to 15.
2021-07-14test: Fix wallet_listdescriptors.py if bdb is not compiledHennadii Stepanov
2021-07-14Merge bitcoin/bitcoin#20354: test: Add feature_taproot.py --previous_releaseMarcoFalke
fa80e10d94dbf86da84fc761b09fb631155a5b25 test: Add feature_taproot.py --previous_release (MarcoFalke) 85ccffa26686c6c9adbd18bdde37fc1747281bab test: move releases download incantation to README (Sjors Provoost) 29d6b1da2a862bfbb14e7821979c97416c5400e8 test: previous releases: add v0.20.1 (Sjors Provoost) Pull request description: Disabling the new consensus code at runtime is fine, but potentially fragile and incomplete. Fix that by giving the option to run with a version that has been compiled without any taproot code. ACKs for top commit: Sjors: tACK fa80e10 NelsonGaldeman: tACK fa80e10d94dbf86da84fc761b09fb631155a5b25 Tree-SHA512: 1a1feef823f08c05268759645a8974e1b2d39a024258f5e6acecbe25097aae3fa9302c27262978b40f1aa8e7b525b60c0047199010f2a5d6017dd6434b4066f0
2021-07-13Merge bitcoin/bitcoin#22112: Force port 0 in I2PW. J. van der Laan
4101ec9d2e05a35c35f587a28f1feee6cebcc61b doc: mention that we enforce port=0 in I2P (Vasil Dimov) e0a2b390c144e123e2fc8a289fdff36815476964 addrman: reset I2P ports to 0 when loading from disk (Vasil Dimov) 41cda9d075ebcab1dbb950160ebe9d0ba7b5745e test: ensure I2P ports are handled as expected (Vasil Dimov) 4f432bd738c420512a86a51ab3e00323f396b89e net: do not connect to I2P hosts on port!=0 (Vasil Dimov) 1f096f091ebd88efb18154b8894a38122c39624f net: distinguish default port per network (Vasil Dimov) aeac3bce3ead1f24ca782079ef0defa86fd8cb98 net: change I2P seeds' ports to 0 (Vasil Dimov) 38f900290cc3a839e99bef13474d35e1c02e6b0d net: change assumed I2P port to 0 (Vasil Dimov) Pull request description: _This is an alternative to https://github.com/bitcoin/bitcoin/pull/21514, inspired by https://github.com/bitcoin/bitcoin/pull/21514#issuecomment-815049933. They are mutually exclusive. Just one of them should be merged._ Change assumed ports for I2P to 0 (instead of the default 8333) as this is closer to what actually happens underneath with SAM 3.1 (https://github.com/bitcoin/bitcoin/pull/21514#issuecomment-812632520, https://github.com/bitcoin/bitcoin/pull/21514#issuecomment-816564719). Don't connect to I2P peers with advertised port != 0 (we don't specify a port to our SAM 3.1 proxy and it always connects to port = 0). Note, this change: * Keeps I2P addresses with port != 0 in addrman and relays them to others via P2P gossip. There may be non-bitcoin-core-22.0 peers using SAM 3.2 and for them such addresses may be useful. * Silently refuses to connect to I2P hosts with port != 0. This is ok for automatically chosen peers from addrman. Not so ok for peers provided via `-addnode` or `-connect` - a user who specifies `foo.b32.i2p:1234` (non zero port) may wonder why "nothing is happening". Fixes #21389 ACKs for top commit: laanwj: Code review ACK 4101ec9d2e05a35c35f587a28f1feee6cebcc61b jonatack: re-ACK 4101ec9d2e05a35c35f587a28f1feee6cebcc61b per `git range-diff efff9c3 0b0ee03 4101ec9`, built with DDEBUG_ADDRMAN, did fairly extensive testing on mainnet both with and without a peers.dat / -dnsseeds=0 to test boostrapping. Tree-SHA512: 0e3c019e1dc05e54f559275859d3450e0c735596d179e30b66811aad9d5b5fabe3dcc44571e8f7b99f9fe16453eee393d6e153454dd873b9ff14907d4e6354fe
2021-07-12Merge bitcoin/bitcoin#20234: net: don't bind on 0.0.0.0 if binds are ↵W. J. van der Laan
restricted to Tor 2feec3ce3130961f98ceb030951d0e46d3b9096c net: don't bind on 0.0.0.0 if binds are restricted to Tor (Vasil Dimov) Pull request description: The semantic of `-bind` is to restrict the binding only to some address. If not specified, then the user does not care and we bind to `0.0.0.0`. If specified then we should honor the restriction and bind only to the specified address. Before this change, if no `-bind` is given then we would bind to `0.0.0.0:8333` and to `127.0.0.1:8334` (incoming Tor) which is ok - the user does not care to restrict the binding. However, if only `-bind=addr:port=onion` is given (without ordinary `-bind=`) then we would bind to `addr:port` _and_ to `0.0.0.0:8333` in addition. Change the above to not do the additional bind: if only `-bind=addr:port=onion` is given (without ordinary `-bind=`) then bind to `addr:port` (only) and consider incoming connections to that as Tor and do not advertise it. I.e. a Tor-only node. ACKs for top commit: laanwj: Code review ACK 2feec3ce3130961f98ceb030951d0e46d3b9096c jonatack: utACK 2feec3ce3130961f98ceb030951d0e46d3b9096c per `git diff a004833 2feec3c` hebasto: ACK 2feec3ce3130961f98ceb030951d0e46d3b9096c, tested on Linux Mint 20.1 (x86_64): Tree-SHA512: a04483af601706da928958b92dc560f9cfcc78ab0bb9d74414636eed1c6f29ed538ce1fb5a17d41ed82c9c9a45ca94899d0966e7ef93da809c9bcdcdb1d1f040
2021-07-09Merge bitcoin/bitcoin#22253: validation: distinguish between same tx and ↵W. J. van der Laan
same-nonwitness-data tx in mempool b7a8cd9963e810264d3b45d0ad15af863965c47a [test] submit same txid different wtxid as mempool tx (glozow) fdb48163bfbf34f79dc78ffaa2bbf9e39af96687 [validation] distinguish same txid different wtxid in mempool (glozow) Pull request description: On master, if you submit a transaction with the same txid but different witness to the mempool, it thinks the transactions are the same. Users submitting through `BroadcastTransaction()` (i.e. `sendrawtransaction` or the wallet) don't get notified that there's a different transaction in the mempool, although it doesn't crash. Users submitting through `testmempoolaccept()` will get a "txn-already-in-mempool" error. This PR simply distinguishes between `txn-already-in-mempool` and `txn-same-nonwitness-data-in-mempool`, without handling them differently: `sendrawtransaction` still will not throw, but `testmempoolaccept` will give you a different error. I believe the intention of #19645 is to allow full swaps of transactions that have different witnesses but identical nonwitness data. Returning a different error message + adding a test was suggested: https://github.com/bitcoin/bitcoin/pull/19645#issuecomment-705109193 so this is that PR. ACKs for top commit: naumenkogs: ACK b7a8cd9963e810264d3b45d0ad15af863965c47a jnewbery: Code review ACK b7a8cd9963e810264d3b45d0ad15af863965c47a theStack: Code-review ACK b7a8cd9963e810264d3b45d0ad15af863965c47a darosior: re-utACK b7a8cd9963e810264d3b45d0ad15af863965c47a Tree-SHA512: 9c6591edaf8727ba5b4675977adb8cbdef7288584003b6cd659828032dc92d2ae915800a8ef8b6fdffe112c1b660df72297a3dcf2e2e3e1f959c6cb3678c63ee
2021-07-09test: ensure I2P ports are handled as expectedVasil Dimov
2021-07-09Merge bitcoin/bitcoin#22363: test: refactor: use `script_util` helpers for ↵MarcoFalke
creating P2{PKH,SH,WPKH,WSH} scripts 905d672b743edf31531d095ffe800449eaffec69 test: use script_util helpers for creating P2W{PKH,SH} scripts (Sebastian Falbesoner) 285a65ccfde2e811cfe01e916b998c02ee534a97 test: use script_util helpers for creating P2SH scripts (Sebastian Falbesoner) b57b633b942da162045b1fe7743a8abdfeaf60e2 test: use script_util helpers for creating P2PKH scripts (Sebastian Falbesoner) 61b6a017a9f99ef072b2d1980dd547eb20093352 test: wallet util: fix multisig P2SH-P2WSH script creation (Sebastian Falbesoner) Pull request description: PR #18788 (commit 08067aebfd7e838e6ce6b030c31a69422260fc6f) introduced functions to generate output scripts for various types. This PR replaces all manual CScript creations in the P2PKH, P2SH, P2WPKH, P2WSH formats with those helpers in order to increase readability and maintainability over the functional test codebase. The first commit fixes a bug in the wallet_util helper module w.r.t. to P2SH-P2WSH script creation (the result is not used in any test so far, hence it can still be seen as refactoring). The following table shows a summary of the output script patterns tackled in this PR: | Type | master branch | PR branch | | ---------- | ------------- | ------------- | | P2PKH | `CScript([OP_DUP, OP_HASH160, hash160(key), OP_EQUALVERIFY, OP_CHECKSIG])` | `key_to_p2pkh_script(key)` | | | `CScript([OP_DUP, OP_HASH160, keyhash, OP_EQUALVERIFY, OP_CHECKSIG])` | `keyhash_to_p2pkh_script(keyhash)` | | P2SH | `CScript([OP_HASH160, hash160(script), OP_EQUAL])` | `script_to_p2sh_script(script)` | | P2WPKH | `CScript([OP_0, hash160(key)])` | `key_to_p2wpkh_script(key)` | | P2WSH | `CScript([OP_0, sha256(script)])` | `script_to_p2wsh_script(script)` | Note that the `key_to_...` helpers can't be used if an invalid key size (not 33 or 65 bytes) is passed, which is the case in some rare instances where the scripts still have to be created manually. Possible follow-up ideas: * further simplify by identifying P2SH-wrapped scripts and using `key_to_p2sh_p2wpkh_script()` and `script_to_p2sh_p2wsh_script()` helpers * introduce and use `key_to_p2pk_script()` helper for P2PK scripts ACKs for top commit: rajarshimaitra: tACK https://github.com/bitcoin/bitcoin/pull/22363/commits/905d672b743edf31531d095ffe800449eaffec69 LarryRuane: tACK 905d672b743edf31531d095ffe800449eaffec69 0xB10C: ACK 905d672b743edf31531d095ffe800449eaffec69 MarcoFalke: review ACK 905d672b743edf31531d095ffe800449eaffec69 🕹 Tree-SHA512: 7ccfe69699bc81168ac122b03536720013355c1b2fbb088355b616015318644c4d1cd27e20c4f56c89ad083ae609add4bc838cf6316794d0edb0ce9cf7fa0fd8
2021-07-08[test] submit same txid different wtxid as mempool txglozow
Co-authored-by: Antoine Riard <ariard@student.42.fr> Co-authored-by: Antoine Riard <antoine.riard@gmail.com>
2021-07-07net: don't bind on 0.0.0.0 if binds are restricted to TorVasil Dimov
The semantic of `-bind` is to restrict the binding only to some address. If not specified, then the user does not care and we bind to `0.0.0.0`. If specified then we should honor the restriction and bind only to the specified address. Before this change, if no `-bind` is given then we would bind to `0.0.0.0:8333` and to `127.0.0.1:8334` (incoming Tor) which is ok - the user does not care to restrict the binding. However, if only `-bind=addr:port=onion` is given (without ordinary `-bind=`) then we would bind to `addr:port` _and_ to `0.0.0.0:8333` in addition. Change the above to not do the additional bind: if only `-bind=addr:port=onion` is given (without ordinary `-bind=`) then bind to `addr:port` (only) and consider incoming connections to that as Tor and do not advertise it. I.e. a Tor-only node.
2021-07-05test: add `bad-txns-prevout-null` test to mempool_accept.pySebastian Falbesoner
2021-07-05test: add `bad-txns-prevout-null` test case to invalid_txs.pySebastian Falbesoner
This reject reason is triggered for non-coinbase transactions with a coinbase-like outpoint, i.e. hash=0, n=0xffffffff. Note that the invalid tx templates are currently used in the functional tests feature_block.py and p2p_invalid_tx.py.
2021-07-05test: use script_util helpers for creating P2W{PKH,SH} scriptsSebastian Falbesoner
2021-07-05test: use script_util helpers for creating P2SH scriptsSebastian Falbesoner
2021-07-01Merge bitcoin/bitcoin#22310: test: Add functional test for replacement relay ↵MarcoFalke
fee check c4ddee64c7f80eee05a95116ef1b1dc8a7601183 test: Add test for replacement relay fee check (Antoine Riard) Pull request description: This PR adds rename the `reject_reason` of our implementation of BIP125 rule 4 and adds missing functional test coverage. Note, `insufficient fee` is already the `reject_reason` of few others `PreChecks` replacement checks and as such might be confusing. > The replacement transaction must also pay for its own bandwidth at or above the rate set by the node's minimum relay fee setting. For example, if the minimum relay fee is 1 satoshi/byte and the replacement transaction is 500 bytes total, then the replacement must pay a fee at least 500 satoshis higher than the sum of the originals. ``` // Finally in addition to paying more fees than the conflicts the // new transaction must pay for its own bandwidth. CAmount nDeltaFees = nModifiedFees - nConflictingFees; if (nDeltaFees < ::incrementalRelayFee.GetFee(nSize)) { return state.Invalid(TxValidationResult::TX_MEMPOOL_POLICY, "insufficient fee", strprintf("rejecting replacement %s, not enough additional fees to relay; %s < %s", hash.ToString(), FormatMoney(nDeltaFees), FormatMoney(::incrementalRelayFee.GetFee(nSize)))); } ``` ACKs for top commit: MarcoFalke: cr ACK c4ddee64c7f80eee05a95116ef1b1dc8a7601183 glozow: ACK c4ddee6, one small suggestion if you retouch. Tree-SHA512: 7c5d1065db6e6fe57a9f083bf051a7a55eb9892de3a2888679d4a6853491608c93b6e35887ef383a9988d14713fa13a0b1d6134b7354af5fd54765f0d4e98568
2021-07-01Merge bitcoin/bitcoin#19651: wallet: importdescriptors update existingfanquake
3efaf83c75cd8dc2fa084537b8ed6715fb58c04d wallet: deactivate descriptor (S3RK) 6737d9655bcf527afbd85d610d805a2d0fd28c4f test: wallet importdescriptors update existing (S3RK) 586f1d53d60880ea2873d860f95e3390016620d1 wallet: maintain SPK consistency on internal flag change (S3RK) f1b7db14748d9ee04735b4968366d33bc89aea23 wallet: don't mute exceptions in importdescriptors (S3RK) bf68ebc1cd555f791103f81adc9111e0e55c8003 wallet: allow to import same descriptor twice (S3RK) Pull request description: Rationale: allow updating existing descriptors with `importdescriptors` command. Currently if you run same `importdescriptors` command twice with a descriptor containing private key you will get very confusing error — `Missing required fields`. What happens is that Wallet tries to write imported private key to the disk, but it exists already so we get `DB_KEYEXIST (-30995)` from BerkelyDB. Please note, that we set `DB_NOOVERWRITE` (I guess not to lose some keys accidentally). The exception is caught in `catch (...)` in rpcdump.cpp with a generic error. With this PR if a descriptor is already present than we will update its activeness, internalness, label, range and next_index. For the range only expansion is allowed (range start can only decrease, range end increase). ACKs for top commit: achow101: re-ACK 3efaf83c75cd8dc2fa084537b8ed6715fb58c04d meshcollider: Code review ACK 3efaf83c75cd8dc2fa084537b8ed6715fb58c04d jonatack: Light ACK 3efaf83c75cd8dc2fa084537b8ed6715fb58c04d per `git range-diff a000cb0 5d96704 3efaf83` and as a sanity check, re-debug-built on debian with gcc 10.2.1 and clang 11, ran wallet_importdescriptors.py Tree-SHA512: 122c4b621d64ec8a3b625f3aed9f01a2b5cbaf2029ad0325b5ff38d67fff5cd35324335fabe2dd5169548b01b267c81be6ae0f5c834342f3d5f6eeed515c4843
2021-06-30test: Add test for replacement relay fee checkAntoine Riard
2021-06-28wallet: deactivate descriptorS3RK
2021-06-28test: wallet importdescriptors update existingS3RK
2021-06-28wallet: allow to import same descriptor twiceS3RK
2021-06-28test: use script_util helpers for creating P2PKH scriptsSebastian Falbesoner
2021-06-28test: wallet util: fix multisig P2SH-P2WSH script creationSebastian Falbesoner
2021-06-24wallet, rpc: listdescriptors does not need unlockedAndrew Chow
With the last hardened xpub cache, we don't neeed to have the wallet be unlocked for listdescriptors.
2021-06-24Merge bitcoin/bitcoin#22154: Add OutputType::BECH32M and related wallet ↵W. J. van der Laan
support for fetching bech32m addresses 754f134a50cc56cdf0baf996d909c992770fcc97 wallet: Add error message to GetReservedDestination (Andrew Chow) 87a0e7a3b7c0ffd545e537bd497cdc3e67d045f6 Disallow bech32m addresses for legacy wallet things (Andrew Chow) 6dbe4d10728f882986ed0d9ed77bc736f051c662 Use BECH32M for tr() desc, WitV1Taproot, and WitUnknown CTxDests (Andrew Chow) 699dfcd8ad9487a4e04c1ffc68211e84e126b3d2 Opportunistically use bech32m change addresses if available (Andrew Chow) 0262536c34567743e527dad46912c9ba493252cd Add OutputType::BECH32M (Andrew Chow) 177c15d2f7cd5406ddbce8217fc023057539b828 Limit LegacyScriptPubKeyMan address types (Andrew Chow) Pull request description: Currently bech32m addresses are classfied as bech32. Because bech32m is incompatible with bech32, we need to define a new `OutputType` for it so that it can be handled correctly. This PR adds `OutputType::BECH32M`, updates all of the relevant `OutputType` classifications, and handle requests for bech32m addresses. There is now a `bech32m` address type string that can be used. * `tr()` descriptors now report their output type as `OutputType::BECH32M`. `WtinessV1Taproot` and `WitnessUnknown` are also classified as `OutputType::BECH32M`. * Bech32m addresses are completely disabled for legacy wallets. They cannot be imported (explicitly disallowed in `importaddress` and `importmulti`), will not be created when getting all destinations for a pubkey, and will not be added with `addmultisigaddress`. Additional protections have been added to `LegacyScriptPubKeyMan` to disallow attempting to retrieve bech32m addresses. * Since Taproot multisigs are not implemented yet, `createmultisig` will also disallow the bech32m address type. * As Taproot is not yet active, `DescriptorScriptPubKeyMan` cannot and will not create a `tr()` descriptor. Protections have been added to make sure this cannot occur. * The change address type detection algorithm has been updated to return `bech32m` when there is a segwit v1+ output script and the wallet has a bech32m `ScriptPubKeyMan`, falling back to bech32 if one is not available. ACKs for top commit: laanwj: re-review ACK 754f134a50cc56cdf0baf996d909c992770fcc97 Sjors: re-utACK 754f134: only change is switching to `bech32m` in two `wallet_taproot.py` test cases. fjahr: re-ACK 754f134a50cc56cdf0baf996d909c992770fcc97 jonatack: ACK 754f134a50cc56cdf0baf996d909c992770fcc97 Tree-SHA512: 6ea90867d3631d0d438e2b08ce6ed930f37d01323224661e8e38f183ea5ee2ab65b5891394a3612c7382a1aff907b457616c6725665a10c320174017b998ca9f
2021-06-24Merge bitcoin/bitcoin#22311: test: Add missing ↵MarcoFalke
syncwithvalidationinterfacequeue in p2p_blockfilters fadddd13eef4428f5fa7237583d4be41a9335cd9 test: Add missing syncwithvalidationinterfacequeue (MarcoFalke) faa211fc6e3d4984b8edff1d762dd4cba205d982 test: Misc cleanup (MarcoFalke) fa1668bf5084a190b26b022b9e625a7be3defa6e test: Run pep-8 (MarcoFalke) facd97ae0f0d816107aa3bc9de321244200636a0 scripted-diff: Renames (MarcoFalke) Pull request description: The index on the block filters is running in the background on the validation interface. To avoid intermittent test failures, it needs to be synced. Also other cleanups. ACKs for top commit: lsilva01: Tested ACK https://github.com/bitcoin/bitcoin/pull/22311/commits/fadddd13eef4428f5fa7237583d4be41a9335cd9 on Ubuntu 20.04 Tree-SHA512: d858405db426a2f9d5620059dd88bcead4e3fba3ccc6bd8023f624b768fbcfa2203246fb0b2db620490321730d990f0e78063b21a26988c969cb126d4bd697bd
2021-06-24Merge bitcoin/bitcoin#22257: test: refactor: various (de)serialization ↵MarcoFalke
helpers cleanups/improvements bdb8b9a347e68f80a2e8d44ce5590a2e8214b6bb test: doc: improve doc for `from_hex` helper (mention `to_hex` alternative) (Sebastian Falbesoner) 191405420815d49ab50184513717a303fc2744d6 scripted-diff: test: rename `FromHex` to `from_hex` (Sebastian Falbesoner) a79396fe5f8f81c78cf84117a87074c6ff6c9d95 test: remove `ToHex` helper, use .serialize().hex() instead (Sebastian Falbesoner) 2ce7b47958c4a10ba20dc86c011d71cda4b070a5 test: introduce `tx_from_hex` helper for tx deserialization (Sebastian Falbesoner) Pull request description: There are still many functional tests that perform conversions from a hex-string to a message object (deserialization) manually. This PR identifies all those instances and replaces them with a newly introduced helper `tx_from_hex`. Instances were found via * `git grep "deserialize.*BytesIO"` and some of them manually, when it were not one-liners. Further, the helper `ToHex` was removed and simply replaced by `.serialize().hex()`, since now both variants are in use (sometimes even within the same test) and using the helper doesn't really have an advantage in readability. (see discussion https://github.com/bitcoin/bitcoin/pull/22257#discussion_r652404782) ACKs for top commit: MarcoFalke: review re-ACK bdb8b9a347e68f80a2e8d44ce5590a2e8214b6bb 😁 Tree-SHA512: e25d7dc85918de1d6755a5cea65471b07a743204c20ad1c2f71ff07ef48cc1b9ad3fe5f515c1efaba2b2e3d89384e7980380c5d81895f9826e2046808cd3266e
2021-06-24Merge bitcoin/bitcoin#22306: [test] Improvements to p2p_addr_relay.pyMarcoFalke
6168eb06b2044f00f18727b955b672fc91c60bd7 [test] Prevent intermittent issue (Amiti Uttarwar) 1d8193e2a2950fd957654b601e85ab888899c394 [test] Remove GetAddrStore class (Amiti Uttarwar) ef2f149bf2d12e2d14e441fdf701808f0f1dfb8e [test] Update GetAddrStore callers to use AddrReceiver (Amiti Uttarwar) e8c67ea19ac4c0aec4a0b449ac3a4152f80dfff5 [test] Add functionality to AddrReceiver (Amiti Uttarwar) 09dc073cff250afd47a3e219f35d1257add764e9 [test] Allow AddrReceiver to be used more generally (Amiti Uttarwar) Pull request description: A test refactor broken out from #21528 & a fix to #22243. This PR: 1. consolidates the two helper classes into one, with the intent of making the test logic more clear & usable as we add more subtests to the file 2. hopefully fixes the test flakiness by bumping up the mocktime interval to ensure `m_next_addr_send` timer triggers ACKs for top commit: mzumsande: Code-Review ACK 6168eb06b2044f00f18727b955b672fc91c60bd7 lsilva01: Tested ACK https://github.com/bitcoin/bitcoin/pull/22306/commits/6168eb06b2044f00f18727b955b672fc91c60bd7 on Ubuntu 20.04 brunoerg: tACK 6168eb06b2044f00f18727b955b672fc91c60bd7 Tree-SHA512: 248324f9d37e0e5ffe4acc437cd72ad9a2960abc868a97c6040a36e6ea8b59029127ac4f63fcf67d981a5bb4dbf2334bb2c23c541fae8e910d5523884bcedcba
2021-06-23Merge bitcoin/bitcoin#22166: Add support for inferring tr() descriptorsSamuel Dobson
d637a9b397816e34652d0c4d383308e39770737a Taproot descriptor inference (Pieter Wuille) c7388e5ada394b7fe94d6263fb02e9dd28ab367e Report address as solvable based on inferred descriptor (Pieter Wuille) 29e5dd1a5b9a1879e6c3c7e153b2e6f33a79e905 consensus refactor: extract ComputeTapleafHash, ComputeTaprootMerkleRoot (Pieter Wuille) Pull request description: Includes: * First commit from #21365, adding TaprootSpendData in SigningProvider * A refactor to expose ComputeTapleafHash and ComputeTaprootMerkleRoot from script/interpreter * A tiny change to make `getaddressinfo` report tr() descriptors as solvable (so that inferred descriptors are shown), despite not having signing code for them. * Logic to infer the script tree back from TaprootSpendData, and then use that to infer descriptors. ACKs for top commit: achow101: re-ACK d637a9b397816e34652d0c4d383308e39770737a Sjors: re-utACK d637a9b meshcollider: Code review ACK d637a9b397816e34652d0c4d383308e39770737a Tree-SHA512: 5ab9b95da662382d8549004be4a1297a577d7caca6b068f875c7c9343723931d03fa9cbf133de11f83b74e4851490ce820fb80413c77b9e8495a5f812e505d86
2021-06-23Merge bitcoin/bitcoin#20966: banman: save the banlist in a JSON format on diskMarcoFalke
bb719a08db173a753984a04534de6f148b87b17a style: remove () from assert in rpc_setban.py (Vasil Dimov) 24b10ebda301548b8ff4b0c73fefc367ad5dc22b doc: fix grammar in doc/files.md (Vasil Dimov) dd4e957dcdfc971a4a971995ff2db9fb787d23c3 test: ensure banlist can be read from disk after restart (Vasil Dimov) d197977ae2076903ed12ab7616a7f93e88be02e1 banman: save the banlist in a JSON format on disk (Vasil Dimov) Pull request description: Save the banlist in `banlist.json` instead of `banlist.dat`. This makes it possible to store Tor v3 entries in the banlist on disk (and any other addresses that cannot be serialized in addrv1 format). Only read `banlist.dat` if it exists and `banlist.json` does not exist (first start after an upgrade). Supersedes https://github.com/bitcoin/bitcoin/pull/20904 Resolves https://github.com/bitcoin/bitcoin/issues/19748 ACKs for top commit: jonatack: Code review re-ACK bb719a08db173a753984a04534de6f148b87b17a per `git range-diff 6a67366 4b52c72 bb719a0` achow101: Code Review ACK bb719a08db173a753984a04534de6f148b87b17a Tree-SHA512: fc135c3a1fe20bcf5d008ce6bea251b4135e56c78bf8f750b4bd8144c095b81ffe165133cdc7e4715875eec7e7c4e13ad9f5d2450b21102af063d7c8abf716b6
2021-06-23Merge bitcoin/bitcoin#22313: test: Add missing sync_all to ↵MarcoFalke
feature_coinstatsindex fafd9165e911bf33d6212ca8a613b71878c82449 test: Add missing sync_all to feature_coinstatsindex (MarcoFalke) Pull request description: Sync the blocks before invalidating them to ensure all nodes are on the right tip. Otherwise nodes[0] might stay on the "stale" block and the test fails (intermittently) ACKs for top commit: jamesob: crACK https://github.com/bitcoin/bitcoin/pull/22313/commits/fafd9165e911bf33d6212ca8a613b71878c82449 Tree-SHA512: ca567b97b839b56c91d52831eaac18d8c843d376be90c9fd8b49d2eb4a46b801a1d2402996d5dfe2bef3e2c9bd75d19ed443e3f42cc4679c5f20043ba556efc8
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.
2021-06-22Disallow bech32m addresses for legacy wallet thingsAndrew Chow
We don't want the legacy wallet to ever have bech32m addresses so don't allow importing them. This includes addmultisigaddress as that is a legacy wallet only RPC Additionally, bech32m multisigs are not available yet, so disallow them in createmultisig.
2021-06-22Use BECH32M for tr() desc, WitV1Taproot, and WitUnknown CTxDestsAndrew Chow
The tr() descriptor, WitnessV1Taproot CTxDestination, and WitnessUnknown CTxDestination are OutputType::BECH32M so they should report as such.
2021-06-22test: Add missing sync_all to feature_coinstatsindexMarcoFalke
2021-06-22test: Add missing syncwithvalidationinterfacequeueMarcoFalke
2021-06-22test: Misc cleanupMarcoFalke
* Replace wait_until with assert_equal where possible * Use send_and_ping helper where possible
2021-06-22test: Run pep-8MarcoFalke
Can be reviewed with --word-diff-regex=.
2021-06-22scripted-diff: RenamesMarcoFalke
-BEGIN VERIFY SCRIPT- ren() { sed -i "s/\<$1\>/$2/g" test/functional/p2p_blockfilters.py ; } # Rename from "node" to "peer" to avoid confusion with self.nodes ren node0 peer_0 ren node1 peer_1 # Remove the confusing "C" prefix ren CFiltersClient FiltersClient -END VERIFY SCRIPT-
2021-06-22Revert "test: Add temporary logging to debug #20975"MarcoFalke
This reverts commit faa94961d6e38392ba068381726ed4e033367b03.
2021-06-22Merge bitcoin/bitcoin#22201: test: Fix TestShell to allow running in Jupyter ↵MarcoFalke
Notebook 168b6c317ca054c1287c36be532964e861f44266 add dummy file param to fix jupyter (Josiah Baker) Pull request description: this fixes argparse to use `parse_known_args`. previously, if an unknown argument was passed, argparse would fail with an `unrecognized arguments: %s` error. ## why the documentation mentions being able to run `TestShell` in a REPL interpreter or a jupyter notebook. when i tried to run inside a jupyter notebook, i got the following error: ![image](https://user-images.githubusercontent.com/7444140/121382910-57554880-c947-11eb-94f2-49da8679528c.png) this was due to the notebook passing the filename of the notebook as an argument. this is a known problem with notebooks and argparse, documented here: https://stackoverflow.com/questions/48796169/how-to-fix-ipykernel-launcher-py-error-unrecognized-arguments-in-jupyter ## testing to test, make sure you have jupyter notebooks installed. you can do this by running: ``` pip install notebook ``` or following instructions from [here](https://jupyterlab.readthedocs.io/en/stable/getting_started/installation.html). once installed, start a notebook (`jupyter notebook`), launch a python3 kernel and run the following snippet: ```python import sys # make sure this is the path for your system sys.path.insert(0, "/path/to/bitcoin/test/functional") from test_framework.test_shell import TestShell test = TestShell().setup(num_nodes=2, setup_clean_chain=True) ``` you should see the following output, without errors: ![image](https://user-images.githubusercontent.com/7444140/121383301-a307f200-c947-11eb-83b6-6c50b2cada25.png) if you are unfamiliar with notebooks, here is a short guide on using them: https://jupyter.readthedocs.io/en/latest/running.html ACKs for top commit: MarcoFalke: review ACK 168b6c317ca054c1287c36be532964e861f44266 jamesob: crACK https://github.com/bitcoin/bitcoin/pull/22201/commits/168b6c317ca054c1287c36be532964e861f44266 practicalswift: cr ACK 168b6c317ca054c1287c36be532964e861f44266 Tree-SHA512: 4fee1563bf64a1cf9009934182412446cde03badf2f19553b78ad2cb3ceb0e5e085a5db41ed440473494ac047f04641311ecbba3948761c6553d0ca4b54937b4
2021-06-21[test] Prevent intermittent issueAmiti Uttarwar
Since m_next_addr_send is on a Poisson distribution, increase the mocktime bump to ensure we don't experience flakiness in the tests. Closes #22243.
2021-06-21[test] Remove GetAddrStore classAmiti Uttarwar
2021-06-21[test] Update GetAddrStore callers to use AddrReceiverAmiti Uttarwar
2021-06-21[test] Add functionality to AddrReceiverAmiti Uttarwar
Add two simple helper functions to `AddrReceiver` to support callers currently using `GetAddrStore` [used in next commit].
2021-06-21[test] Allow AddrReceiver to be used more generallyAmiti Uttarwar
The `on_addr` functionality of `AddrReceiver` tests logic specific to how the addr messages are set up in the test bodies. To allow other callers to also use `AddrReceiver`, only apply the assertion logic if the caller indicates desirability by setting `test_addr_contents` to true when initializing the class.
2021-06-21add dummy file param to fix jupyterJosiah Baker
testshell in jupyter was failing due to an extra arg. this adds a dummy -f param, which allows TestShell to be used in a command line or jupyter environment