Commit graph

33 commits

Author SHA1 Message Date
Hennadii Stepanov
a0473442d1
scripted-diff: Add __file__ argument to BitcoinTestFramework.init()
-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-07-16 22:06:47 +01:00
MarcoFalke
fae0b21e6c
test: Combine sync_send_with_ping and sync_with_ping 2023-09-05 12:11:10 +02:00
kouloumos
0377d6bb42 test: add rescan_utxos in MiniWallet's initialization
this simplifies usage when MiniWallet is used with a pre-mined chain.
2023-01-16 19:01:09 +02:00
Jon Atack
459cb637ac script, test: fix python linter E275 errors with flake8 5.0.4 2023-01-03 10:59:56 -08:00
Hennadii Stepanov
306ccd4927
scripted-diff: Bump copyright headers
-BEGIN VERIFY SCRIPT-
./contrib/devtools/copyright_header.py update ./
-END VERIFY SCRIPT-

Commits of previous years:
- 2021: f47dda2c58
- 2020: fa0074e2d8
- 2019: aaaaad6ac9
2022-12-24 23:49:50 +00:00
MacroFake
dddd1acf58
net: Set relay in version msg to peers with relay permission 2022-10-04 16:07:00 +02:00
MacroFake
fafddafc2c
refactor: Introduce PeerManagerImpl::RejectIncomingTxs
Currently there are some confusions in net_processing:

* There is confusion between `-blocksonly mode` and `block-relay-only`,
  so adjust all comments to use the same nomenclature.
* Whether to disconnect peers for providing invs/txs is implemented
  differently. For example, it seems a bit confusing to disconnect
  `block-relay-only` peers with `relay` permission when they send a tx
  message, but not when they send an inv message. Also, keeping track of
  their inv announcements seems both wasteful and confusing, as it does
  nothing. This isn't possible in practice, as outbound connections do
  not have permissions assigned, but sees fragile to rely on. Especially
  in light of proposed changes to make that possible:
  https://github.com/bitcoin/bitcoin/pull/17167
2022-06-14 08:39:55 +02:00
John Newbery
1066d10f71 scripted-diff: rename TxRelay members
-BEGIN VERIFY SCRIPT-
ren() { sed -i "s:\<$1\>:$2:g" $(git grep -l "\<$1\>" ./src ./test); }

ren cs_filter             m_bloom_filter_mutex
ren fRelayTxes            m_relay_txs
ren pfilter               m_bloom_filter
ren cs_tx_inventory       m_tx_inventory_mutex
ren filterInventoryKnown  m_tx_inventory_known_filter
ren setInventoryTxToSend  m_tx_inventory_to_send
ren fSendMempool          m_send_mempool
ren nNextInvSend          m_next_inv_send_time
ren minFeeFilter          m_fee_filter_received
ren lastSentFeeFilter     m_fee_filter_sent
-END VERIFY SCRIPT-
2022-03-18 11:35:58 +00:00
Sebastian Falbesoner
b24f6c6855 test: MiniWallet: support default from_node for creating txs
If no `from_node` parameter is passed explicitely to the
`create_self_transfer` method, the test node passed in the course
of creating the MiniWallet instance is used.  This seems to
be the main use-case in most of the current functional
tests, i.e. in many instances the calls can be shortened.
2022-01-11 16:22:33 +01:00
MarcoFalke
fac23c2114
scripted-diff: Bump copyright headers
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-10 11:10:24 +01:00
MarcoFalke
fa66a7d732
p2p: Rename fBlocksOnly, Add test
The new name describes better what the bool does and also limits the confusion of the three different concepts:
* fBlocksOnly (This bool to skip tx invs)
* -blocksonly (A setting to ignore incoming txs)
* block-relay-only (A connection type in the block-relay-only P2P graph)
2021-09-12 12:53:50 +02:00
MarcoFalke
fac66d0a39
test: Simplify p2p_blocksonly test with new miniwallet rescan_utxos method 2021-09-12 12:13:58 +02:00
MarcoFalke
fa0b916971
scripted-diff: Use generate* from TestFramework
-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-09-02 10:34:35 +02:00
Kiminuo
bfa9309ad6 Use COINBASE_MATURITY constant in functional tests. 2021-05-31 07:32:28 +02:00
Sebastian Falbesoner
9f767e8438 test: use MiniWallet for p2p_blocksonly.py
This test can now be run even with the Bitcoin Core wallet disabled.
2021-05-06 02:30:05 +02:00
MarcoFalke
faa51ef4d3
test: Fix intermittent issue in p2p_addr_relay.py 2021-04-28 08:16:29 +02:00
Fabian Jahr
590bda79e8
scripted-diff: Remove setup_clean_chain if default is not changed
-BEGIN VERIFY SCRIPT-
git grep -l "self.setup_clean_chain = False" test/functional/*.py | xargs sed -i "/self.setup_clean_chain = False/d";
-END VERIFY SCRIPT-
2021-02-01 23:13:38 +01:00
Amiti Uttarwar
602e69e427 [test] P2PBlocksOnly - Test block-relay-only connections.
Ensure we will disconnect if the peer sends us a transaction & we don't
announce transactions to the peer.
2021-01-07 10:15:56 -08:00
Amiti Uttarwar
8bb6beacb1 [test/refactor] P2PBlocksOnly - Extract transaction violation test into helper.
This is in preparation for use in the next commit.
2021-01-07 10:15:56 -08:00
Amiti Uttarwar
99791e7560 [test/refactor] P2PBlocksOnly - simplify transaction creation using blocktool helper. 2021-01-07 10:15:56 -08:00
MarcoFalke
fa0074e2d8
scripted-diff: Bump copyright headers
-BEGIN VERIFY SCRIPT-
./contrib/devtools/copyright_header.py update ./
-END VERIFY SCRIPT-
2020-12-31 09:45:41 +01:00
Amiti Uttarwar
b1a936d4ae [rpc] Remove deprecated "whitelisted" field from getpeerinfo 2020-12-26 13:30:54 -08:00
Luke Dashjr
d681a28219 RPC: getpeerinfo: Deprecate "whitelisted" field (replaced by "permissions") 2020-10-14 14:16:42 +00:00
MarcoFalke
78f912c901
Merge #19804: test/refactor: reference p2p objects explicitly and remove confusing Test_Node.p2p property
10d61505fe [test] remove confusing p2p property (gzhao408)
549d30faf0 scripted-diff: replace p2p with p2ps[0] in p2p_invalid_tx (gzhao408)
7a0de46aea [doc] sample code for test framework p2p objects (gzhao408)
784f757994 [refactor] clarify tests by referencing p2p objects directly (gzhao408)

Pull request description:

  The `TestNode` has a `p2p` property which is an alias for `p2ps[0]`.

  I think this should be removed because it can be confusing and misleading (to both the test writer and reviewer), especially if a TestNode has multiple p2ps connected (which is the case for many tests).
  Another example is when a test has multiple subtests that connect 1 p2p and use the `p2p` property to reference it. If the subtests don't completely clean up after themselves, the subtests may affect one another.

  The best way to refer to a connected p2p is use the object returned by `add_p2p_connection` like this:
  ```py
  p2p_conn = node.add_p2p_connection(P2PInterface())
  ```
  A good example is [p2p_invalid_locator.py](https://github.com/bitcoin/bitcoin/blob/master/test/functional/p2p_invalid_locator.py), which cleans up after itself (waits in both `wait_for_disconnect` and in `disconnect_p2ps`) but wouldn't need so much complexity if it just referenced the connections directly.

  If there is only one connected, it's not really that tedious to just use `node.p2ps[0]` instead of `node.p2p` (and it can always be aliased inside the test itself).

ACKs for top commit:
  robot-dreams:
    utACK 10d61505fe
  jnewbery:
    utACK 10d61505fe
  guggero:
    Concept ACK 10d61505.

Tree-SHA512: 5965548929794ec660dae03467640cb2156d7d826cefd26d3a126472cbc2494b855c1d26bbb7b412281fbdc92b9798b9765a85c27bc1a97f7798f27f64db6f13
2020-09-25 14:18:31 +02:00
t-bast
e15344889a
Clarify blocksonly whitelistforcerelay test
As discussed in https://github.com/bitcoin/bitcoin/issues/19943, this
test may be a bit misleading to newcomers.

We underscore the fact that our peer needs to run a modified version of
Bitcoin Core to actually relay transactions to a `blocksonly` node and
benefit from the `whitelistforcerelay` parameter.
2020-09-21 10:16:09 +02:00
gzhao408
784f757994 [refactor] clarify tests by referencing p2p objects directly
Use object returned from add_p2p_connection to refer to
p2ps. Add a test class attribute if it needs to be used across
many methods. Don't use the p2p property.
2020-09-10 07:37:14 -07:00
John Newbery
85165d4332 scripted-diff: Rename mininode to p2p
-BEGIN VERIFY SCRIPT-
sed -i 's/\.mininode/\.p2p/g' $(git grep -l "mininode")
git mv test/functional/test_framework/mininode.py test/functional/test_framework/p2p.py
-END VERIFY SCRIPT-
2020-08-21 15:52:20 +01:00
Fabian Jahr
cacd85209e test: Use wtxid relay generally in functional tests 2020-07-19 02:10:42 -04:00
MarcoFalke
fab5586122
doc: Use precise permission flags where possible 2020-07-10 15:37:42 +02:00
MarcoFalke
fa0540cd46
net: Extract download permission from noban 2020-07-09 12:48:05 +02:00
glowang
be01449cc8 Add test for param interaction b/w -blocksonly and -whitelistforcerelay 2020-05-04 21:57:47 -07:00
Suhas Daftuar
0ba08020c9 Disconnect peers violating blocks-only mode
If we set fRelay=false in our VERSION message, and a peer sends an INV or TX
message anyway, disconnect. Since we use fRelay=false to minimize bandwidth,
we should not tolerate remaining connected to a peer violating the protocol.
2019-09-04 14:58:36 -04:00
MarcoFalke
fa320de79f
test: Add test for p2p_blocksonly 2019-05-13 10:44:42 -04:00