aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--contrib/gitian-downloader/jonasschnelli-key.pgpbin2230 -> 6974 bytes
-rw-r--r--contrib/verify-commits/trusted-keys1
-rw-r--r--doc/reduce-traffic.md (renamed from doc/reducetraffic.md)7
-rw-r--r--doc/release-notes.md3
-rwxr-xr-xqa/rpc-tests/maxuploadtarget.py37
-rw-r--r--src/main.cpp3
-rw-r--r--src/rpcrawtransaction.cpp1
-rw-r--r--src/wallet/rpcwallet.cpp5
8 files changed, 50 insertions, 7 deletions
diff --git a/contrib/gitian-downloader/jonasschnelli-key.pgp b/contrib/gitian-downloader/jonasschnelli-key.pgp
index fe44c0fbd4..3831eaea11 100644
--- a/contrib/gitian-downloader/jonasschnelli-key.pgp
+++ b/contrib/gitian-downloader/jonasschnelli-key.pgp
Binary files differ
diff --git a/contrib/verify-commits/trusted-keys b/contrib/verify-commits/trusted-keys
index fcf2b98e77..a0d0f82db3 100644
--- a/contrib/verify-commits/trusted-keys
+++ b/contrib/verify-commits/trusted-keys
@@ -4,3 +4,4 @@
AF8BE07C7049F3A26B239D5325B3083201782B2F
81291FA67D2C379A006A053FEAB5AF94D9E9ABE7
3F1888C6DCA92A6499C4911FDBA1A67379A1A931
+32EE5C4C3FA15CCADB46ABE529D4BCB6416F53EC
diff --git a/doc/reducetraffic.md b/doc/reduce-traffic.md
index a79571913a..2d86588eb2 100644
--- a/doc/reducetraffic.md
+++ b/doc/reduce-traffic.md
@@ -1,7 +1,7 @@
Reduce Traffic
==============
-Some node operators need to deal with bandwith caps imposed by their ISPs.
+Some node operators need to deal with bandwidth caps imposed by their ISPs.
By default, bitcoin-core allows up to 125 connections to different peers, 8 of
which are outbound. You can therefore, have at most 117 inbound connections.
@@ -22,6 +22,9 @@ Keep in mind that new nodes require other nodes that are willing to serve
historic blocks. **The recommended minimum is 144 blocks per day (max. 144MB
per day)**
+Whitelisted peers will never be disconnected, although their traffic counts for
+calculating the target.
+
## 2. Disable "listening" (`-listen=0`)
Disabling listening will result in fewer nodes connected (remember the maximum of 8
@@ -30,6 +33,6 @@ blocks and transactions to fewer nodes.
## 3. Reduce maximum connections (`-maxconnections=<num>`)
-Reducing the maximum connected nodes to a miniumum could be desirable if traffic
+Reducing the maximum connected nodes to a minimum could be desirable if traffic
limits are tiny. Keep in mind that bitcoin's trustless model works best if you are
connected to a handful of nodes.
diff --git a/doc/release-notes.md b/doc/release-notes.md
index 2e9cc16940..e4dcc60cff 100644
--- a/doc/release-notes.md
+++ b/doc/release-notes.md
@@ -184,6 +184,9 @@ This option can be specified in MiB per day and is turned off by default
(`-maxuploadtarget=0`).
The recommended minimum is 144 * MAX_BLOCK_SIZE (currently 144MB) per day.
+Whitelisted peers will never be disconnected, although their traffic counts for
+calculating the target.
+
A more detailed documentation about keeping traffic low can be found in
[/doc/reducetraffic.md](/doc/reducetraffic.md).
diff --git a/qa/rpc-tests/maxuploadtarget.py b/qa/rpc-tests/maxuploadtarget.py
index 148c5f37e4..e714465db1 100755
--- a/qa/rpc-tests/maxuploadtarget.py
+++ b/qa/rpc-tests/maxuploadtarget.py
@@ -195,7 +195,7 @@ class MaxUploadTest(BitcoinTestFramework):
daily_buffer = 144 * 1000000
max_bytes_available = max_bytes_per_day - daily_buffer
success_count = max_bytes_available / old_block_size
-
+
# 144MB will be reserved for relaying new blocks, so expect this to
# succeed for ~70 tries.
for i in xrange(success_count):
@@ -228,7 +228,7 @@ class MaxUploadTest(BitcoinTestFramework):
test_nodes[1].send_message(getdata_request)
test_nodes[1].wait_for_disconnect()
assert_equal(len(self.nodes[0].getpeerinfo()), 1)
-
+
print "Peer 1 disconnected after trying to download old block"
print "Advancing system time on node to clear counters..."
@@ -245,5 +245,38 @@ class MaxUploadTest(BitcoinTestFramework):
[c.disconnect_node() for c in connections]
+ #stop and start node 0 with 1MB maxuploadtarget, whitelist 127.0.0.1
+ print "Restarting nodes with -whitelist=127.0.0.1"
+ stop_node(self.nodes[0], 0)
+ self.nodes[0] = start_node(0, self.options.tmpdir, ["-debug", "-whitelist=127.0.0.1", "-maxuploadtarget=1", "-blockmaxsize=999000"])
+
+ #recreate/reconnect 3 test nodes
+ test_nodes = []
+ connections = []
+
+ for i in xrange(3):
+ test_nodes.append(TestNode())
+ connections.append(NodeConn('127.0.0.1', p2p_port(0), self.nodes[0], test_nodes[i]))
+ test_nodes[i].add_connection(connections[i])
+
+ NetworkThread().start() # Start up network handling in another thread
+ [x.wait_for_verack() for x in test_nodes]
+
+ #retrieve 20 blocks which should be enough to break the 1MB limit
+ getdata_request.inv = [CInv(2, big_new_block)]
+ for i in xrange(20):
+ test_nodes[1].send_message(getdata_request)
+ test_nodes[1].sync_with_ping()
+ assert_equal(test_nodes[1].block_receive_map[big_new_block], i+1)
+
+ getdata_request.inv = [CInv(2, big_old_block)]
+ test_nodes[1].send_message(getdata_request)
+ test_nodes[1].wait_for_disconnect()
+ assert_equal(len(self.nodes[0].getpeerinfo()), 3) #node is still connected because of the whitelist
+
+ print "Peer 1 still connected after trying to download old block (whitelisted)"
+
+ [c.disconnect_node() for c in connections]
+
if __name__ == '__main__':
MaxUploadTest().main()
diff --git a/src/main.cpp b/src/main.cpp
index fb529eb5b6..9fca183bb0 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -3867,8 +3867,9 @@ void static ProcessGetData(CNode* pfrom, const Consensus::Params& consensusParam
}
}
// disconnect node in case we have reached the outbound limit for serving historical blocks
+ // never disconnect whitelisted nodes
static const int nOneWeek = 7 * 24 * 60 * 60; // assume > 1 week = historical
- if (send && CNode::OutboundTargetReached(true) && ( ((pindexBestHeader != NULL) && (pindexBestHeader->GetBlockTime() - mi->second->GetBlockTime() > nOneWeek)) || inv.type == MSG_FILTERED_BLOCK) )
+ if (send && CNode::OutboundTargetReached(true) && ( ((pindexBestHeader != NULL) && (pindexBestHeader->GetBlockTime() - mi->second->GetBlockTime() > nOneWeek)) || inv.type == MSG_FILTERED_BLOCK) && !pfrom->fWhitelisted)
{
LogPrint("net", "historical block serving limit reached, disconnect peer=%d\n", pfrom->GetId());
diff --git a/src/rpcrawtransaction.cpp b/src/rpcrawtransaction.cpp
index 11d9a6f2bb..3bda459245 100644
--- a/src/rpcrawtransaction.cpp
+++ b/src/rpcrawtransaction.cpp
@@ -506,7 +506,6 @@ UniValue decodescript(const UniValue& params, bool fHelp)
+ HelpExampleRpc("decodescript", "\"hexstring\"")
);
- LOCK(cs_main);
RPCTypeCheck(params, boost::assign::list_of(UniValue::VSTR));
UniValue r(UniValue::VOBJ);
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp
index d93050d98c..7b7c9b3256 100644
--- a/src/wallet/rpcwallet.cpp
+++ b/src/wallet/rpcwallet.cpp
@@ -2418,9 +2418,12 @@ UniValue fundrawtransaction(const UniValue& params, bool fHelp)
if (!DecodeHexTx(origTx, params[0].get_str()))
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed");
+ if (origTx.vout.size() == 0)
+ throw JSONRPCError(RPC_INVALID_PARAMETER, "TX must have at least one output");
+
bool includeWatching = false;
if (params.size() > 1)
- includeWatching = true;
+ includeWatching = params[1].get_bool();
CMutableTransaction tx(origTx);
CAmount nFee;