From a66fc11fc4a7f7c0e35e127f2ae5753833a266e5 Mon Sep 17 00:00:00 2001 From: Adrian Gallagher Date: Sun, 29 Jan 2017 07:00:00 -0800 Subject: [PATCH] Litecoin: Protocol and default settings 0) Adjust BIP30 enforcement values 1) Reduce amount that peers can adjust our time to eliminate an attack vector. Thanks to coblee for this fix. 2) Zeitgeist2 patch - thanks to Lolcust and ArtForz. This fixes an issue where a 51% attack can change difficulty at will. Go back the full period unless it's the first retarget after genesis. 3) Avoid overflow in CalculateNextWorkRequired(). Thanks to pooler for the overflow fix. 4) Zeitgeist2 bool fshift bnNew.bits(). Thanks to romanornr for this path. 5) SegWit ContextualCheckBlockHeader adjustment and extra coverage. 6) Reject peer proto version below 70002. Thanks to wtogami for this patch. 7) Send final alert message to nodes warning about removal of the alert system. Thanks to coblee for this patch. 8) Adjust default settings for Litecoin. 9) Adjust STALE_CHECK_INTERVAL value --- contrib/linearize/example-linearize.cfg | 6 +++--- contrib/qos/README.md | 4 ++-- contrib/qos/tc.sh | 12 ++++++------ contrib/seeds/generate-seeds.py | 4 ++-- doc/REST-interface.md | 4 ++-- doc/tor.md | 10 +++++----- share/examples/bitcoin.conf | 6 +++--- src/amount.h | 2 +- src/net_processing.cpp | 4 ++-- src/pow.cpp | 24 ++++++++++++++++++++---- src/rpc/net.cpp | 6 +++--- src/test/compress_tests.cpp | 4 ++-- src/test/miner_tests.cpp | 2 +- src/test/netbase_tests.cpp | 6 +++--- src/timedata.h | 2 +- src/validation.cpp | 10 ++++++++-- src/validation.h | 2 +- test/functional/feature_nulldummy.py | 4 +++- test/functional/feature_proxy.py | 4 ++-- test/functional/p2p_segwit.py | 7 ++++++- 20 files changed, 76 insertions(+), 47 deletions(-) diff --git a/contrib/linearize/example-linearize.cfg b/contrib/linearize/example-linearize.cfg index 5f566261c..96e65964e 100644 --- a/contrib/linearize/example-linearize.cfg +++ b/contrib/linearize/example-linearize.cfg @@ -5,13 +5,13 @@ rpcpassword=somepassword host=127.0.0.1 #mainnet default -port=8332 +port=9332 #testnet default -#port=18332 +#port=19332 #regtest default -#port=18443 +#port=19443 #signet default #port=38332 diff --git a/contrib/qos/README.md b/contrib/qos/README.md index 0ded87c58..2d1cf7e5b 100644 --- a/contrib/qos/README.md +++ b/contrib/qos/README.md @@ -1,5 +1,5 @@ ### QoS (Quality of service) ### -This is a Linux bash script that will set up tc to limit the outgoing bandwidth for connections to the Bitcoin network. It limits outbound TCP traffic with a source or destination port of 8333, but not if the destination IP is within a LAN. +This is a Linux bash script that will set up tc to limit the outgoing bandwidth for connections to the Litecoin network. It limits outbound TCP traffic with a source or destination port of 9333, but not if the destination IP is within a LAN (defined as 192.168.x.x). -This means one can have an always-on bitcoind instance running, and another local bitcoind/bitcoin-qt instance which connects to this node and receives blocks from it. +This means one can have an always-on litecoind instance running, and another local litecoind/litecoin-qt instance which connects to this node and receives blocks from it. diff --git a/contrib/qos/tc.sh b/contrib/qos/tc.sh index 8408545a2..320d97b00 100644 --- a/contrib/qos/tc.sh +++ b/contrib/qos/tc.sh @@ -9,7 +9,7 @@ export LC_ALL=C IF="eth0" #limit of the network interface in question LINKCEIL="1gbit" -#limit outbound Bitcoin protocol traffic to this rate +#limit outbound Litecoin protocol traffic to this rate LIMIT="160kbit" #defines the IPv4 address space for which you wish to disable rate limiting LOCALNET_V4="192.168.0.0/16" @@ -47,16 +47,16 @@ fi # ret=$? #done -#limit outgoing traffic to and from port 8333. but not when dealing with a host on the local network +#limit outgoing traffic to and from port 9333. but not when dealing with a host on the local network # (defined by $LOCALNET_V4 and $LOCALNET_V6) # --set-mark marks packages matching these criteria with the number "2" (v4) # --set-mark marks packages matching these criteria with the number "4" (v6) # these packets are filtered by the tc filter with "handle 2" # this filter sends the packages into the 1:11 class, and this class is limited to ${LIMIT} -iptables -t mangle -A OUTPUT -p tcp -m tcp --dport 8333 ! -d ${LOCALNET_V4} -j MARK --set-mark 0x2 -iptables -t mangle -A OUTPUT -p tcp -m tcp --sport 8333 ! -d ${LOCALNET_V4} -j MARK --set-mark 0x2 +iptables -t mangle -A OUTPUT -p tcp -m tcp --dport 9333 ! -d ${LOCALNET_V4} -j MARK --set-mark 0x2 +iptables -t mangle -A OUTPUT -p tcp -m tcp --sport 9333 ! -d ${LOCALNET_V4} -j MARK --set-mark 0x2 if [ -n "${LOCALNET_V6}" ] ; then - ip6tables -t mangle -A OUTPUT -p tcp -m tcp --dport 8333 ! -d ${LOCALNET_V6} -j MARK --set-mark 0x4 - ip6tables -t mangle -A OUTPUT -p tcp -m tcp --sport 8333 ! -d ${LOCALNET_V6} -j MARK --set-mark 0x4 + ip6tables -t mangle -A OUTPUT -p tcp -m tcp --dport 9333 ! -d ${LOCALNET_V6} -j MARK --set-mark 0x4 + ip6tables -t mangle -A OUTPUT -p tcp -m tcp --sport 9333 ! -d ${LOCALNET_V6} -j MARK --set-mark 0x4 fi diff --git a/contrib/seeds/generate-seeds.py b/contrib/seeds/generate-seeds.py index 7630a7a4f..2bb439b06 100755 --- a/contrib/seeds/generate-seeds.py +++ b/contrib/seeds/generate-seeds.py @@ -128,10 +128,10 @@ def main(): g.write(' * IPv4 as well as onion addresses are wrapped inside an IPv6 address accordingly.\n') g.write(' */\n') with open(os.path.join(indir,'nodes_main.txt'), 'r', encoding="utf8") as f: - process_nodes(g, f, 'pnSeed6_main', 8333) + process_nodes(g, f, 'pnSeed6_main', 9333) g.write('\n') with open(os.path.join(indir,'nodes_test.txt'), 'r', encoding="utf8") as f: - process_nodes(g, f, 'pnSeed6_test', 18333) + process_nodes(g, f, 'pnSeed6_test', 19335) g.write('#endif // BITCOIN_CHAINPARAMSSEEDS_H\n') if __name__ == '__main__': diff --git a/doc/REST-interface.md b/doc/REST-interface.md index 3b127703b..4d2a95816 100644 --- a/doc/REST-interface.md +++ b/doc/REST-interface.md @@ -83,7 +83,7 @@ https://github.com/bitcoin/bips/blob/master/bip-0064.mediawiki Example: ``` -$ curl localhost:18332/rest/getutxos/checkmempool/b2cdfd7b89def827ff8af7cd9bff7627ff72e5e8b0f71210f92ea7a4000c5d75-0.json 2>/dev/null | json_pp +$ curl localhost:19332/rest/getutxos/checkmempool/b2cdfd7b89def827ff8af7cd9bff7627ff72e5e8b0f71210f92ea7a4000c5d75-0.json 2>/dev/null | json_pp { "chainHeight" : 325347, "chaintipHash" : "00000000fb01a7f3745a717f8caebee056c484e6e0bfe4a9591c235bb70506fb", @@ -125,4 +125,4 @@ Only supports JSON as output format. Risks ------------- -Running a web browser on the same node with a REST enabled bitcoind can be a risk. Accessing prepared XSS websites could read out tx/block data of your node by placing links like `