Merge branch 'master-0.10b' into master-0.10

This commit is contained in:
Warren Togami 2015-06-02 22:53:08 -07:00
commit c70cbb9043
4 changed files with 26 additions and 17 deletions

View File

@ -1,6 +1,6 @@
Litecoin Core version 0.10.1.3 is now available from:
Litecoin Core version 0.10.2.1 is now available from:
<https://download.litecoin.org/litecoin-0.10.1.3/>
<https://download.litecoin.org/litecoin-0.10.2.1/>
This is a new major version release, bringing bug fixes and translation
updates. It is recommended to upgrade to this version.
@ -23,9 +23,9 @@ litecoind/litecoin-qt (on Linux).
Downgrade warning
------------------
Because release 0.10.0 and later makes use of headers-first synchronization and
Because release 0.10+ and later makes use of headers-first synchronization and
parallel block download (see further), the block files and databases are not
backwards-compatible with pre-0.10 versions of Bitcoin Core or other software:
backwards-compatible with pre-0.10 versions of Litecoin Core or other software:
* Blocks will be stored on disk out of order (in the order they are
received, really), which makes it incompatible with some tools or
@ -44,9 +44,9 @@ supported and may break as soon as the older version attempts to reindex.
This does not affect wallet forward or backward compatibility.
Litecoin 0.10.1.3 Change log
Litecoin 0.10.2.1 Change log
============================
This release is based upon Bitcoin Core v0.10.1. Their upstream changelog applies to us and
This release is based upon Bitcoin Core v0.10.2. Their upstream changelog applies to us and
is included in as separate release-notes. This section describes the Litecoin-specific differences.
Protocol:
@ -62,13 +62,13 @@ Protocol:
- bnProofOfWorkLimit = >> 20 (instead of >> 32)
- See 9a980612005adffdeb2a17ca7a09fe126dd45e0e for Genesis Parameters
- zeitgeist2 protection: b1b31d15cc720a1c186431b21ecc9d1a9062bcb6 Slightly different way to calculate difficulty changes.
- Litecoin Core v0.10.1.3 is protocol version 70003 (instead of 70002)
- Litecoin Core v0.10.2.1 is protocol version 70003 (instead of 70002)
Relay:
- Litecoin Core rounds transaction size up to the nearest 1000 bytes before calculating fees. This size rounding behavior is to mimic fee calculation of Litecoin v0.6 and v0.8.
- Bitcoin's IsDust() is disabled in favor of Litecoin's fee-based dust penalty.
- Fee-based Dust Penalty: For each transaction output smaller than DUST_THRESHOLD (currently 0.001 LTC) the default relay/mining policy will expect an additional 1000 bytes of fee. Otherwise the transaction will be rejected from relay/mining. Such transactions are also disqualified from the free/high-priority transaction rule.
- Miners and relays can adjust the expect fee per-KB with the -minrelaytxfee parameter.
- Miners and relays can adjust the expected fee per-KB with the -minrelaytxfee parameter.
Wallet:
- Coins smaller than 0.00001 LTC are by default ignored by the wallet. Use the -mininput parameter if you want to see smaller coins.

View File

@ -1214,15 +1214,15 @@ CSubNet::CSubNet(const std::string &strSubnet, bool fAllowLookup)
std::string strNetmask = strSubnet.substr(slash + 1);
int32_t n;
// IPv4 addresses start at offset 12, and first 12 bytes must match, so just offset n
int noffset = network.IsIPv4() ? (12 * 8) : 0;
const int astartofs = network.IsIPv4() ? 12 : 0;
if (ParseInt32(strNetmask, &n)) // If valid number, assume /24 symtex
{
if(n >= 0 && n <= (128 - noffset)) // Only valid if in range of bits of address
if(n >= 0 && n <= (128 - astartofs*8)) // Only valid if in range of bits of address
{
n += noffset;
n += astartofs*8;
// Clear bits [n..127]
for (; n < 128; ++n)
netmask[n>>3] &= ~(1<<(n&7));
netmask[n>>3] &= ~(1<<(7-(n&7)));
}
else
{
@ -1233,12 +1233,10 @@ CSubNet::CSubNet(const std::string &strSubnet, bool fAllowLookup)
{
if (LookupHost(strNetmask.c_str(), vIP, 1, false)) // Never allow lookup for netmask
{
// Remember: GetByte returns bytes in reversed order
// Copy only the *last* four bytes in case of IPv4, the rest of the mask should stay 1's as
// we don't want pchIPv4 to be part of the mask.
int asize = network.IsIPv4() ? 4 : 16;
for(int x=0; x<asize; ++x)
netmask[15-x] = vIP[0].GetByte(x);
for(int x=astartofs; x<16; ++x)
netmask[x] = vIP[0].ip[x];
}
else
{
@ -1251,6 +1249,10 @@ CSubNet::CSubNet(const std::string &strSubnet, bool fAllowLookup)
{
valid = false;
}
// Normalize network according to netmask
for(int x=0; x<16; ++x)
network.ip[x] &= netmask[x];
}
bool CSubNet::Match(const CNetAddr &addr) const
@ -1258,7 +1260,7 @@ bool CSubNet::Match(const CNetAddr &addr) const
if (!valid || !addr.IsValid())
return false;
for(int x=0; x<16; ++x)
if ((addr.GetByte(x) & netmask[15-x]) != network.GetByte(x))
if ((addr.ip[x] & netmask[x]) != network.ip[x])
return false;
return true;
}

View File

@ -100,6 +100,8 @@ class CNetAddr
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
READWRITE(FLATDATA(ip));
}
friend class CSubNet;
};
class CSubNet

View File

@ -116,6 +116,11 @@ BOOST_AUTO_TEST_CASE(subnet_test)
BOOST_CHECK(CSubNet("1:2:3:4:5:6:7:8").Match(CNetAddr("1:2:3:4:5:6:7:8")));
BOOST_CHECK(!CSubNet("1:2:3:4:5:6:7:8").Match(CNetAddr("1:2:3:4:5:6:7:9")));
BOOST_CHECK(CSubNet("1:2:3:4:5:6:7:0/112").Match(CNetAddr("1:2:3:4:5:6:7:1234")));
BOOST_CHECK(CSubNet("192.168.0.1/24").Match(CNetAddr("192.168.0.2")));
BOOST_CHECK(CSubNet("192.168.0.20/29").Match(CNetAddr("192.168.0.18")));
BOOST_CHECK(CSubNet("1.2.2.1/24").Match(CNetAddr("1.2.2.4")));
BOOST_CHECK(CSubNet("1.2.2.110/31").Match(CNetAddr("1.2.2.111")));
BOOST_CHECK(CSubNet("1.2.2.20/26").Match(CNetAddr("1.2.2.63")));
// All-Matching IPv6 Matches arbitrary IPv4 and IPv6
BOOST_CHECK(CSubNet("::/0").Match(CNetAddr("1:2:3:4:5:6:7:1234")));
BOOST_CHECK(CSubNet("::/0").Match(CNetAddr("1.2.3.4")));