Skip to content

Commit 49bc102

Browse files
authored
Merge branch 'bitcoin-core:master' into 2022_12_FixReceiveCoinsMultiselect
2 parents 2d7585e + 5b3f05b commit 49bc102

File tree

5 files changed

+45
-5
lines changed

5 files changed

+45
-5
lines changed

doc/i2p.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,29 @@ listening port to 0 when listening for incoming I2P connections and advertises
133133
its own I2P address with port 0. Furthermore, it will not attempt to connect to
134134
I2P addresses with a non-zero port number because with SAM v3.1 the destination
135135
port (`TO_PORT`) is always set to 0 and is not in the control of Bitcoin Core.
136+
137+
## Bandwidth
138+
139+
I2P routers may route a large amount of general network traffic with their
140+
default settings. Check your router's configuration to limit the amount of this
141+
traffic relayed, if desired.
142+
143+
With `i2pd`, the amount of bandwidth being shared with the wider network can be
144+
adjusted with the `bandwidth`, `share` and `transittunnels` options in your
145+
`i2pd.conf` file. For example, to limit total I2P traffic to 256KB/s and share
146+
50% of this limit for a maximum of 20 transit tunnels:
147+
148+
```
149+
bandwidth = 256
150+
share = 50
151+
152+
[limits]
153+
transittunnels = 20
154+
```
155+
156+
If you prefer not to relay any public I2P traffic and only permit I2P traffic
157+
from programs which are connecting via the SAM proxy, e.g. Bitcoin Core, you
158+
can set the `notransit` option to `true`.
159+
160+
Similar bandwidth configuration options for the Java I2P router can be found in
161+
`http://127.0.0.1:7657/config` under the "Bandwidth" tab.

src/net_processing.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1743,6 +1743,8 @@ std::optional<std::string> PeerManagerImpl::FetchBlock(NodeId peer_id, const CBl
17431743
LOCK(cs_main);
17441744

17451745
// Mark block as in-flight unless it already is (for this peer).
1746+
// If the peer does not send us a block, vBlocksInFlight remains non-empty,
1747+
// causing us to timeout and disconnect.
17461748
// If a block was already in-flight for a different peer, its BLOCKTXN
17471749
// response will be dropped.
17481750
if (!BlockRequested(peer_id, block_index)) return "Already requested from this peer";
@@ -2298,9 +2300,9 @@ void PeerManagerImpl::ProcessGetData(CNode& pfrom, Peer& peer, const std::atomic
22982300
std::vector<uint256> parent_ids_to_add;
22992301
{
23002302
LOCK(m_mempool.cs);
2301-
auto txiter = m_mempool.GetIter(tx->GetHash());
2302-
if (txiter) {
2303-
const CTxMemPoolEntry::Parents& parents = (*txiter)->GetMemPoolParentsConst();
2303+
auto tx_iter = m_mempool.GetIter(tx->GetHash());
2304+
if (tx_iter) {
2305+
const CTxMemPoolEntry::Parents& parents = (*tx_iter)->GetMemPoolParentsConst();
23042306
parent_ids_to_add.reserve(parents.size());
23052307
for (const CTxMemPoolEntry& parent : parents) {
23062308
if (parent.GetTime() > now - UNCONDITIONAL_RELAY_DELAY) {

src/rpc/blockchain.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,9 @@ static RPCHelpMan getblockfrompeer()
428428
"getblockfrompeer",
429429
"Attempt to fetch block from a given peer.\n\n"
430430
"We must have the header for this block, e.g. using submitheader.\n"
431-
"Subsequent calls for the same block and a new peer will cause the response from the previous peer to be ignored.\n\n"
431+
"Subsequent calls for the same block and a new peer will cause the response from the previous peer to be ignored.\n"
432+
"Peers generally ignore requests for a stale block that they never fully verified, or one that is more than a month old.\n"
433+
"When a peer does not respond with a block, we will disconnect.\n\n"
432434
"Returns an empty JSON object if the request was successfully scheduled.",
433435
{
434436
{"blockhash", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The block hash to try to fetch"},

test/functional/rpc_net.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,8 @@ def test_getnetworkinfo(self):
185185
self.nodes[0].setnetworkactive(state=False)
186186
assert_equal(self.nodes[0].getnetworkinfo()['networkactive'], False)
187187
# Wait a bit for all sockets to close
188-
self.wait_until(lambda: self.nodes[0].getnetworkinfo()['connections'] == 0, timeout=3)
188+
for n in self.nodes:
189+
self.wait_until(lambda: n.getnetworkinfo()['connections'] == 0, timeout=3)
189190

190191
with self.nodes[0].assert_debug_log(expected_msgs=['SetNetworkActive: true\n']):
191192
self.nodes[0].setnetworkactive(state=True)

test/functional/wallet_sendall.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,12 @@ def sendall_fails_on_high_fee(self):
284284
recipients=[self.remainder_target],
285285
fee_rate=100000)
286286

287+
@cleanup
288+
def sendall_fails_on_low_fee(self):
289+
self.log.info("Test sendall fails if the transaction fee is lower than the minimum fee rate setting")
290+
assert_raises_rpc_error(-8, "Fee rate (0.999 sat/vB) is lower than the minimum fee rate setting (1.000 sat/vB)",
291+
self.wallet.sendall, recipients=[self.recipient], fee_rate=0.999)
292+
287293
@cleanup
288294
def sendall_watchonly_specific_inputs(self):
289295
self.log.info("Test sendall with a subset of UTXO pool in a watchonly wallet")
@@ -376,6 +382,9 @@ def run_test(self):
376382
# Sendall fails when providing a fee that is too high
377383
self.sendall_fails_on_high_fee()
378384

385+
# Sendall fails when fee rate is lower than minimum
386+
self.sendall_fails_on_low_fee()
387+
379388
# Sendall succeeds with watchonly wallets spending specific UTXOs
380389
self.sendall_watchonly_specific_inputs()
381390

0 commit comments

Comments
 (0)