</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
- <PreprocessorDefinitions>USE_UPNP;UNICODE;WIN32;_SCL_SECURE_NO_WARNINGS;USE_LEVELDB;USE_IPV6=1;__STDC_FORMAT_MACROS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>USE_UPNP;UNICODE;WIN32;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;USE_LEVELDB;USE_IPV6=1;__STDC_FORMAT_MACROS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\src\leveldb\include;..\..\..\deps\openssl-1.0.1j\inc32;..\..\..\deps\db-6.0.20\build_windows;..\..\..\deps\boost_1_55_0;..\..\..\deps\boost_1_55_0\boost;.\GeneratedFiles;.\GeneratedFiles\$(ConfigurationName);.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Optimization>Disabled</Optimization>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
- <PreprocessorDefinitions>USE_UPNP;UNICODE;WIN32;_WIN32;_SCL_SECURE_NO_WARNINGS;USE_LEVELDB;USE_IPV6=1;__STDC_FORMAT_MACROS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>USE_UPNP;UNICODE;WIN32;_WIN32;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;USE_LEVELDB;USE_IPV6=1;__STDC_FORMAT_MACROS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\src\leveldb\include;..\..\..\Deps\openssl-1.0.1j\inc32;..\..\..\Deps\db-6.0.20\build_windows;..\..\..\Deps\boost_1_55_0;..\..\..\Deps\boost_1_55_0\boost;.\GeneratedFiles;.\GeneratedFiles\$(ConfigurationName);.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Optimization>Disabled</Optimization>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
- <PreprocessorDefinitions>USE_UPNP;UNICODE;WIN32;_SCL_SECURE_NO_WARNINGS;USE_LEVELDB;USE_IPV6=1;__STDC_FORMAT_MACROS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>USE_UPNP;UNICODE;WIN32;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;USE_LEVELDB;USE_IPV6=1;__STDC_FORMAT_MACROS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\src\leveldb\include;..\..\..\deps\openssl-1.0.1j\inc32;..\..\..\deps\db-6.0.20\build_windows;..\..\..\deps\boost_1_55_0;..\..\..\deps\boost_1_55_0\boost;.\GeneratedFiles;.\GeneratedFiles\$(ConfigurationName);.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
- <PreprocessorDefinitions>USE_UPNP;UNICODE;WIN32;_SCL_SECURE_NO_WARNINGS;USE_LEVELDB;USE_IPV6=1;__STDC_FORMAT_MACROS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>USE_UPNP;UNICODE;WIN32;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;USE_LEVELDB;USE_IPV6=1;__STDC_FORMAT_MACROS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\src\leveldb\include;..\..\..\Deps\openssl-1.0.1j\inc32;..\..\..\Deps\db-6.0.20\build_windows;..\..\..\Deps\boost_1_55_0;..\..\..\Deps\boost_1_55_0\boost;.\GeneratedFiles;.\GeneratedFiles\$(ConfigurationName);.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<WarningLevel>0</WarningLevel>
</Midl>
<ResourceCompile>
- <PreprocessorDefinitions>_WINDOWS;UNICODE;WIN32;QT_GUI;BOOST_THREAD_USE_LIB;BOOST_SPIRIT_THREADSAFE;QT_NO_DEBUG;QT_WIDGETS_LIB;QT_NETWORK_LIB;QT_GUI_LIB;QT_CORE_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>_WINDOWS;UNICODE;WIN32;QT_GUI;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;BOOST_THREAD_USE_LIB;BOOST_SPIRIT_THREADSAFE;QT_NO_DEBUG;QT_WIDGETS_LIB;QT_NETWORK_LIB;QT_GUI_LIB;QT_CORE_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<PreBuildEvent>
<Command>C:\MyProjects\Deps\qt-everywhere-opensource-src-5.3.2\qtbase\bin\lrelease C:\MyProjects\Novacoin\src\qt\locale\bitcoin_en.ts -qm C:\MyProjects\Novacoin\src\qt\locale\bitcoin_en.qm
<ExceptionHandling>Sync</ExceptionHandling>
<ObjectFileName>$(IntDir)</ObjectFileName>
<Optimization>MaxSpeed</Optimization>
- <PreprocessorDefinitions>USE_UPNP;USE_QRCODE;UNICODE;WIN32;QT_CORE_LIB;QT_GUI_LIB;QT_WIDGETS_LIB;QT_GUI;_SCL_SECURE_NO_WARNINGS;USE_LEVELDB;USE_IPV6=1;__STDC_FORMAT_MACROS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>USE_UPNP;USE_QRCODE;UNICODE;WIN32;QT_CORE_LIB;QT_GUI_LIB;QT_WIDGETS_LIB;QT_GUI;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;USE_LEVELDB;USE_IPV6=1;__STDC_FORMAT_MACROS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessToFile>false</PreprocessToFile>
<ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<WarningLevel>0</WarningLevel>
</Midl>
<ResourceCompile>
- <PreprocessorDefinitions>_WINDOWS;UNICODE;WIN32;QT_GUI;BOOST_THREAD_USE_LIB;BOOST_SPIRIT_THREADSAFE;QT_NO_DEBUG;QT_WIDGETS_LIB;QT_NETWORK_LIB;QT_GUI_LIB;QT_CORE_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>_WINDOWS;UNICODE;WIN32;QT_GUI;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;BOOST_THREAD_USE_LIB;BOOST_SPIRIT_THREADSAFE;QT_NO_DEBUG;QT_WIDGETS_LIB;QT_NETWORK_LIB;QT_GUI_LIB;QT_CORE_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<PreBuildEvent>
<Command>C:\MyProjects\Deps\qt-everywhere-opensource-src-5.3.2-64\qtbase\bin\lrelease C:\MyProjects\Novacoin\src\qt\locale\bitcoin_en.ts -qm C:\MyProjects\Novacoin\src\qt\locale\bitcoin_en.qm
--- /dev/null
+\feff# Distributed under the terms of the GNU General Public License v2
+EAPI=5
+LANGS="en ru"
+
+inherit db-use eutils fdo-mime gnome2-utils kde4-functions qt4-r2
+
+DB_VER="4.8"
+
+DESCRIPTION="NovaCoin - a hybrid PoW+PoS energy efficient p2p-cryptocurrency and electronic payment system."
+HOMEPAGE="https://novaco.in/"
+SRC_URI="https://github.com/${PN}-project/${PN}/archive/nvc-v${PV}.tar.gz -> ${PN}-${PV}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="+dbus -ipv6 kde +qrcode +upnp"
+
+RDEPEND="
+ dev-libs/boost[threads(+)]
+ dev-libs/openssl:0[-bindist]
+ qrcode? (
+ media-gfx/qrencode
+ )
+ upnp? (
+ net-libs/miniupnpc
+ )
+ sys-libs/db:$(db_ver_to_slot "${DB_VER}")[cxx]
+ dev-qt/qtgui:4
+ dbus? (
+ dev-qt/qtdbus:4
+ )
+"
+DEPEND="${RDEPEND}
+ >=app-shells/bash-4.1
+ >sys-devel/gcc-4.3.3
+ >=dev-libs/openssl-0.9.8g
+ >=sys-libs/db-4.8.30
+ >=dev-libs/boost-1.37
+ >=net-libs/miniupnpc-1.6
+"
+
+DOCS="doc/translation_process.md"
+
+S="${WORKDIR}/${PN}-nvc-v${PV}"
+
+src_prepare() {
+ cd src || die
+
+ local filt= yeslang= nolang=
+
+ for ts in $(ls qt/locale/*.ts)
+ do
+ x="${ts/*bitcoin_/}"
+ x="${x/.ts/}"
+ if ! use "linguas_$x"; then
+ nolang="$nolang $x"
+ rm "$ts"
+ filt="$filt\\|$x"
+ else
+ yeslang="$yeslang $x"
+ fi
+ done
+
+ filt="bitcoin_\\(${filt:2}\\)\\.\(qm\|ts\)"
+ sed "/${filt}/d" -i 'qt/bitcoin.qrc'
+ einfo "Languages -- Enabled:$yeslang -- Disabled:$nolang"
+}
+
+src_configure() {
+ OPTS=()
+
+ use dbus && OPTS+=("USE_DBUS=1")
+ if use upnp; then
+ OPTS+=("USE_UPNP=1")
+ else
+ OPTS+=("USE_UPNP=-")
+ fi
+
+ use qrcode && OPTS+=("USE_QRCODE=1")
+ use ipv6 || OPTS+=("USE_IPV6=-")
+
+ OPTS+=("BDB_INCLUDE_PATH=$(db_includedir "${DB_VER}")")
+ OPTS+=("BDB_LIB_SUFFIX=-${DB_VER}")
+
+ if has_version '>=dev-libs/boost-1.52'; then
+ OPTS+=("LIBS+=-lboost_chrono\$\$BOOST_LIB_SUFFIX")
+ fi
+
+ eqmake4 ${PN}-qt.pro "${OPTS[@]}"
+}
+
+src_install() {
+ dobin ${PN}-qt
+
+ insinto /usr/share/pixmaps
+ newins "src/qt/res/icons/novacoin-128.png" "${PN}.png"
+
+ make_desktop_entry "${PN}-qt" "Novacoin" "/usr/share/pixmaps/${PN}.png" "Network;P2P;Finance;"
+
+ if use kde; then
+ insinto /usr/share/kde4/services
+ newins contrib/debian/novacoin-qt.protocol ${PN}.protocol
+ fi
+}
+
+update_caches() {
+ gnome2_icon_cache_update
+ fdo-mime_desktop_database_update
+ buildsycoca
+}
+
+pkg_postinst() {
+ update_caches
+}
+
+pkg_postrm() {
+ update_caches
+}
\ No newline at end of file
// Return the number of (unique) addresses in all tables.
int size()
{
- return vRandom.size();
+ return (int) vRandom.size();
}
// Consistency check
CBigNum(uint64_t n) { BN_init(this); setuint64(n); }
explicit CBigNum(uint256 n) { BN_init(this); setuint256(n); }
- explicit CBigNum(const std::vector<unsigned char>& vch)
+ explicit CBigNum(const std::vector<uint8_t>& vch)
{
BN_init(this);
setvch(vch);
{
uint64_t n = BN_get_word(this);
if (!BN_is_negative(this))
- return (n > (uint64_t)std::numeric_limits<int32_t>::max() ? std::numeric_limits<int32_t>::max() : n);
+ return (n > (uint64_t)std::numeric_limits<int32_t>::max() ? std::numeric_limits<int32_t>::max() : (int32_t)n);
else
return (n > (uint64_t)std::numeric_limits<int32_t>::max() ? std::numeric_limits<int32_t>::min() : -(int32_t)n);
}
void setint64(int64_t sn)
{
- unsigned char pch[sizeof(sn) + 6];
- unsigned char* p = pch + 4;
+ uint8_t pch[sizeof(sn) + 6];
+ uint8_t* p = pch + 4;
bool fNegative;
uint64_t n;
bool fLeadingZeroes = true;
for (int i = 0; i < 8; i++)
{
- unsigned char c = (n >> 56) & 0xff;
+ uint8_t c = (n >> 56) & 0xff;
n <<= 8;
if (fLeadingZeroes)
{
}
*p++ = c;
}
- uint32_t nSize = p - (pch + 4);
+ uint32_t nSize = (uint32_t) (p - (pch + 4));
pch[0] = (nSize >> 24) & 0xff;
pch[1] = (nSize >> 16) & 0xff;
pch[2] = (nSize >> 8) & 0xff;
uint64_t getuint64()
{
- unsigned int nSize = BN_bn2mpi(this, NULL);
+ size_t nSize = BN_bn2mpi(this, NULL);
if (nSize < 4)
return 0;
- std::vector<unsigned char> vch(nSize);
+ std::vector<uint8_t> vch(nSize);
BN_bn2mpi(this, &vch[0]);
if (vch.size() > 4)
vch[4] &= 0x7f;
uint64_t n = 0;
- for (unsigned int i = 0, j = vch.size()-1; i < sizeof(n) && j >= 4; i++, j--)
- ((unsigned char*)&n)[i] = vch[j];
+ for (size_t i = 0, j = vch.size()-1; i < sizeof(n) && j >= 4; i++, j--)
+ ((uint8_t*)&n)[i] = vch[j];
return n;
}
void setuint64(uint64_t n)
{
- unsigned char pch[sizeof(n) + 6];
- unsigned char* p = pch + 4;
+ // Use BN_set_word if word size is sufficient for uint64_t
+ if (sizeof(n) <= sizeof(BN_ULONG))
+ {
+ if (!BN_set_word(this, (BN_ULONG)n))
+ throw bignum_error("CBigNum conversion from uint64_t : BN_set_word failed");
+ return;
+ }
+
+ uint8_t pch[sizeof(n) + 6];
+ uint8_t* p = pch + 4;
bool fLeadingZeroes = true;
for (int i = 0; i < 8; i++)
{
- unsigned char c = (n >> 56) & 0xff;
+ uint8_t c = (n >> 56) & 0xff;
n <<= 8;
if (fLeadingZeroes)
{
}
*p++ = c;
}
- uint32_t nSize = p - (pch + 4);
+ uint32_t nSize = (uint32_t) (p - (pch + 4));
pch[0] = (nSize >> 24) & 0xff;
pch[1] = (nSize >> 16) & 0xff;
pch[2] = (nSize >> 8) & 0xff;
pch[3] = (nSize) & 0xff;
- BN_mpi2bn(pch, p - pch, this);
+ BN_mpi2bn(pch, (int)(p - pch), this);
}
void setuint160(uint160 n)
{
- unsigned char pch[sizeof(n) + 6];
- unsigned char* p = pch + 4;
+ uint8_t pch[sizeof(n) + 6];
+ uint8_t* p = pch + 4;
bool fLeadingZeroes = true;
- unsigned char* pbegin = (unsigned char*)&n;
- unsigned char* psrc = pbegin + sizeof(n);
+ uint8_t* pbegin = (uint8_t*)&n;
+ uint8_t* psrc = pbegin + sizeof(n);
while (psrc != pbegin)
{
- unsigned char c = *(--psrc);
+ uint8_t c = *(--psrc);
if (fLeadingZeroes)
{
if (c == 0)
}
*p++ = c;
}
- uint32_t nSize = p - (pch + 4);
+ uint32_t nSize = (uint32_t) (p - (pch + 4));
pch[0] = (nSize >> 24) & 0xff;
pch[1] = (nSize >> 16) & 0xff;
pch[2] = (nSize >> 8) & 0xff;
pch[3] = (nSize >> 0) & 0xff;
- BN_mpi2bn(pch, p - pch, this);
+ BN_mpi2bn(pch, (int) (p - pch), this);
}
uint160 getuint160() const
unsigned int nSize = BN_bn2mpi(this, NULL);
if (nSize < 4)
return 0;
- std::vector<unsigned char> vch(nSize);
+ std::vector<uint8_t> vch(nSize);
BN_bn2mpi(this, &vch[0]);
if (vch.size() > 4)
vch[4] &= 0x7f;
uint160 n = 0;
- for (unsigned int i = 0, j = vch.size()-1; i < sizeof(n) && j >= 4; i++, j--)
- ((unsigned char*)&n)[i] = vch[j];
+ for (size_t i = 0, j = vch.size()-1; i < sizeof(n) && j >= 4; i++, j--)
+ ((uint8_t*)&n)[i] = vch[j];
return n;
}
void setuint256(uint256 n)
{
- unsigned char pch[sizeof(n) + 6];
- unsigned char* p = pch + 4;
+ uint8_t pch[sizeof(n) + 6];
+ uint8_t* p = pch + 4;
bool fLeadingZeroes = true;
- unsigned char* pbegin = (unsigned char*)&n;
- unsigned char* psrc = pbegin + sizeof(n);
+ uint8_t* pbegin = (uint8_t*)&n;
+ uint8_t* psrc = pbegin + sizeof(n);
while (psrc != pbegin)
{
- unsigned char c = *(--psrc);
+ uint8_t c = *(--psrc);
if (fLeadingZeroes)
{
if (c == 0)
}
*p++ = c;
}
- uint32_t nSize = p - (pch + 4);
+ uint32_t nSize = (uint32_t) (p - (pch + 4));
pch[0] = (nSize >> 24) & 0xff;
pch[1] = (nSize >> 16) & 0xff;
pch[2] = (nSize >> 8) & 0xff;
pch[3] = (nSize >> 0) & 0xff;
- BN_mpi2bn(pch, p - pch, this);
+ BN_mpi2bn(pch, (int) (p - pch), this);
}
uint256 getuint256() const
unsigned int nSize = BN_bn2mpi(this, NULL);
if (nSize < 4)
return 0;
- std::vector<unsigned char> vch(nSize);
+ std::vector<uint8_t> vch(nSize);
BN_bn2mpi(this, &vch[0]);
if (vch.size() > 4)
vch[4] &= 0x7f;
uint256 n = 0;
- for (unsigned int i = 0, j = vch.size()-1; i < sizeof(n) && j >= 4; i++, j--)
- ((unsigned char*)&n)[i] = vch[j];
+ for (size_t i = 0, j = vch.size()-1; i < sizeof(n) && j >= 4; i++, j--)
+ ((uint8_t*)&n)[i] = vch[j];
return n;
}
- void setBytes(const std::vector<unsigned char>& vchBytes)
+ void setBytes(const std::vector<uint8_t>& vchBytes)
{
- BN_bin2bn(&vchBytes[0], vchBytes.size(), this);
+ BN_bin2bn(&vchBytes[0], (int) vchBytes.size(), this);
}
- std::vector<unsigned char> getBytes() const
+ std::vector<uint8_t> getBytes() const
{
int nBytes = BN_num_bytes(this);
- std::vector<unsigned char> vchBytes(nBytes);
+ std::vector<uint8_t> vchBytes(nBytes);
int n = BN_bn2bin(this, &vchBytes[0]);
if (n != nBytes) {
return vchBytes;
}
- void setvch(const std::vector<unsigned char>& vch)
+ void setvch(const std::vector<uint8_t>& vch)
{
- std::vector<unsigned char> vch2(vch.size() + 4);
- uint32_t nSize = vch.size();
+ std::vector<uint8_t> vch2(vch.size() + 4);
+ uint32_t nSize = (uint32_t) vch.size();
// BIGNUM's byte stream format expects 4 bytes of
// big endian size data info at the front
vch2[0] = (nSize >> 24) & 0xff;
vch2[3] = (nSize >> 0) & 0xff;
// swap data to big endian
reverse_copy(vch.begin(), vch.end(), vch2.begin() + 4);
- BN_mpi2bn(&vch2[0], vch2.size(), this);
+ BN_mpi2bn(&vch2[0], (int) vch2.size(), this);
}
- std::vector<unsigned char> getvch() const
+ std::vector<uint8_t> getvch() const
{
unsigned int nSize = BN_bn2mpi(this, NULL);
if (nSize <= 4)
- return std::vector<unsigned char>();
- std::vector<unsigned char> vch(nSize);
+ return std::vector<uint8_t>();
+ std::vector<uint8_t> vch(nSize);
BN_bn2mpi(this, &vch[0]);
vch.erase(vch.begin(), vch.begin() + 4);
reverse(vch.begin(), vch.end());
CBigNum& SetCompact(uint32_t nCompact)
{
uint32_t nSize = nCompact >> 24;
- std::vector<unsigned char> vch(4 + nSize);
+ std::vector<uint8_t> vch(4 + nSize);
vch[3] = nSize;
if (nSize >= 1) vch[4] = (nCompact >> 16) & 0xff;
if (nSize >= 2) vch[5] = (nCompact >> 8) & 0xff;
if (nSize >= 3) vch[6] = (nCompact >> 0) & 0xff;
- BN_mpi2bn(&vch[0], vch.size(), this);
+ BN_mpi2bn(&vch[0], (int) vch.size(), this);
return *this;
}
uint32_t GetCompact() const
{
uint32_t nSize = BN_bn2mpi(this, NULL);
- std::vector<unsigned char> vch(nSize);
+ std::vector<uint8_t> vch(nSize);
nSize -= 4;
BN_bn2mpi(this, &vch[0]);
uint32_t nCompact = nSize << 24;
while (isxdigit(*psz))
{
*this <<= 4;
- int n = phexdigit[(unsigned char)*psz++];
+ int n = phexdigit[(uint8_t)*psz++];
*this += n;
}
if (fNegative)
if (!BN_div(&dv, &rem, &bn, &bnBase, pctx))
throw bignum_error("CBigNum::ToString() : BN_div failed");
bn = dv;
- unsigned int c = rem.getuint32();
+ uint32_t c = rem.getuint32();
str += "0123456789abcdef"[c];
}
if (BN_is_negative(this))
template<typename Stream>
void Unserialize(Stream& s, int nType=0, int nVersion=PROTOCOL_VERSION)
{
- std::vector<unsigned char> vch;
+ std::vector<uint8_t> vch;
::Unserialize(s, vch, nType, nVersion);
setvch(vch);
}
CBigNum ret;
if (!BN_mod_mul(&ret, this, &b, &m, pctx))
throw bignum_error("CBigNum::mul_mod : BN_mod_mul failed");
-
+
return ret;
}
if(ret < 0){
throw bignum_error("CBigNum::isPrime :BN_is_prime");
}
- return ret;
+ return ret != 0;
}
bool isOne() const {
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
ssKey.reserve(1000);
ssKey << key;
- Dbt datKey(&ssKey[0], ssKey.size());
+ Dbt datKey(&ssKey[0], (uint32_t)ssKey.size());
// Read
Dbt datValue;
ssValue >> value;
}
catch (std::exception &e) {
+ (void)e;
return false;
}
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
ssKey.reserve(1000);
ssKey << key;
- Dbt datKey(&ssKey[0], ssKey.size());
+ Dbt datKey(&ssKey[0], (uint32_t)ssKey.size());
// Value
CDataStream ssValue(SER_DISK, CLIENT_VERSION);
ssValue.reserve(10000);
ssValue << value;
- Dbt datValue(&ssValue[0], ssValue.size());
+ Dbt datValue(&ssValue[0], (uint32_t)ssValue.size());
// Write
int ret = pdb->put(activeTxn, &datKey, &datValue, (fOverwrite ? 0 : DB_NOOVERWRITE));
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
ssKey.reserve(1000);
ssKey << key;
- Dbt datKey(&ssKey[0], ssKey.size());
+ Dbt datKey(&ssKey[0], (uint32_t)ssKey.size());
// Erase
int ret = pdb->del(activeTxn, &datKey, 0);
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
ssKey.reserve(1000);
ssKey << key;
- Dbt datKey(&ssKey[0], ssKey.size());
+ Dbt datKey(&ssKey[0], (uint32_t)ssKey.size());
// Exists
int ret = pdb->exists(activeTxn, &datKey, 0);
if (fFlags == DB_SET || fFlags == DB_SET_RANGE || fFlags == DB_GET_BOTH || fFlags == DB_GET_BOTH_RANGE)
{
datKey.set_data(&ssKey[0]);
- datKey.set_size(ssKey.size());
+ datKey.set_size((uint32_t)ssKey.size());
}
Dbt datValue;
if (fFlags == DB_GET_BOTH || fFlags == DB_GET_BOTH_RANGE)
{
datValue.set_data(&ssValue[0]);
- datValue.set_size(ssValue.size());
+ datValue.set_size((uint32_t)ssValue.size());
}
datKey.set_flags(DB_DBT_MALLOC);
datValue.set_flags(DB_DBT_MALLOC);
void SetNull()
{
nVersion = CTransaction::CURRENT_VERSION;
- nTime = GetAdjustedTime();
+ nTime = (uint32_t) GetAdjustedTime();
vin.clear();
vout.clear();
nLockTime = 0;
filein >> *this;
}
catch (std::exception &e) {
+ (void)e;
return error("%s() : deserialize or I/O error", BOOST_CURRENT_FUNCTION);
}
hashSig >>= 159; // take the first bit of the hash
if (fDebug && GetBoolArg("-printstakemodifier"))
printf(" entropybit=%" PRId64 "\n", hashSig.Get64());
- return hashSig.Get64();
+ return (unsigned int)hashSig.Get64();
}
// ppcoin: two types of block: proof-of-work or proof-of-stake
BOOST_FOREACH(const CTransaction& tx, vtx)
vMerkleTree.push_back(tx.GetHash());
int j = 0;
- for (int nSize = vtx.size(); nSize > 1; nSize = (nSize + 1) / 2)
+ for (int nSize = (int)vtx.size(); nSize > 1; nSize = (nSize + 1) / 2)
{
for (int i = 0; i < nSize; i += 2)
{
BuildMerkleTree();
std::vector<uint256> vMerkleBranch;
int j = 0;
- for (int nSize = vtx.size(); nSize > 1; nSize = (nSize + 1) / 2)
+ for (int nSize = (int)vtx.size(); nSize > 1; nSize = (nSize + 1) / 2)
{
int i = std::min(nIndex^1, nSize-1);
vMerkleBranch.push_back(vMerkleTree[j+i]);
filein >> *this;
}
catch (std::exception &e) {
+ (void)e;
return error("%s() : deserialize or I/O error", BOOST_CURRENT_FUNCTION);
}
bool GeneratedStakeModifier() const
{
- return (nFlags & BLOCK_STAKE_MODIFIER);
+ return (nFlags & BLOCK_STAKE_MODIFIER) != 0;
}
void SetStakeModifier(uint64_t nModifier, bool fGeneratedStakeModifier)
void clear();
void queryHashes(std::vector<uint256>& vtxid);
- unsigned long size()
+ size_t size()
{
LOCK(cs);
return mapTx.size();
if (lockRecv)
{
CDataStream& vRecv = pnode->vRecv;
- unsigned int nPos = vRecv.size();
+ uint64_t nPos = vRecv.size();
if (nPos > ReceiveBufferSize()) {
if (!pnode->fDisconnect)
-inline unsigned int ReceiveBufferSize() { return 1000*GetArg("-maxreceivebuffer", 5*1000); }
-inline unsigned int SendBufferSize() { return 1000*GetArg("-maxsendbuffer", 1*1000); }
+inline uint64_t ReceiveBufferSize() { return 1000*GetArg("-maxreceivebuffer", 5*1000); }
+inline uint64_t SendBufferSize() { return 1000*GetArg("-maxsendbuffer", 1*1000); }
void AddOneShot(std::string strDest);
bool RecvLine(SOCKET hSocket, std::string& strLine);
fGetAddr = false;
nMisbehavior = 0;
hashCheckpointKnown = 0;
- setInventoryKnown.max_size(SendBufferSize() / 1000);
+ setInventoryKnown.max_size((size_t)SendBufferSize() / 1000);
// Be shy and don't send version until we hear
if (hSocket != INVALID_SOCKET && !fInbound)
ENTER_CRITICAL_SECTION(cs_vSend);
if (nHeaderStart != -1)
AbortMessage();
- nHeaderStart = vSend.size();
+ nHeaderStart = (int32_t)vSend.size();
vSend << CMessageHeader(pszCommand, 0);
- nMessageStart = vSend.size();
+ nMessageStart = (uint32_t)vSend.size();
if (fDebug)
printf("sending: %s ", pszCommand);
}
return;
// Set the size
- uint32_t nSize = vSend.size() - nMessageStart;
+ uint32_t nSize = (uint32_t) vSend.size() - nMessageStart;
memcpy((char*)&vSend[nHeaderStart] + CMessageHeader::MESSAGE_SIZE_OFFSET, &nSize, sizeof(nSize));
// Set the checksum
{
if (nHeaderStart < 0)
return;
- int nSize = vSend.size() - nMessageStart;
+ int nSize = (int) vSend.size() - nMessageStart;
if (nSize > 0)
EndMessage();
else
{
switch(unit)
{
- case BTC: return QString("NovaCoins");
- case mBTC: return QString("Milli-NovaCoins (1 / 1,000)");
- case uBTC: return QString("Micro-NovaCoins (1 / 1,000,000)");
+ case BTC: return QString(QObject::tr("NovaCoins"));
+ case mBTC: return QString(QObject::tr("Milli-NovaCoins (1 / 1,000)"));
+ case uBTC: return QString(QObject::tr("Micro-NovaCoins (1 / 1,000,000)"));
default: return QString("???");
}
}
}
return QVariant();
}
+
+QString BitcoinUnits::getAmountColumnTitle(int unit)
+{
+ QString amountTitle = QObject::tr("Amount");
+ if (BitcoinUnits::valid(unit))
+ {
+ amountTitle += " ("+BitcoinUnits::name(unit) + ")";
+ }
+ return amountTitle;
+}
\ No newline at end of file
static QString formatWithUnit(int unit, qint64 amount, bool plussign=false);
//! Parse string to coin amount
static bool parse(int unit, const QString &value, qint64 *val_out);
+ //! Gets title for amount column including current display unit if optionsModel reference available */
+ static QString getAmountColumnTitle(int unit);
///@}
//! @name AbstractListModel implementation
<item>
<widget class="QLabel" name="transactionFeeInfoLabel">
<property name="text">
- <string>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB. Fee 0.01 recommended.</string>
+ <string>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB. Fee 0.001 recommended.</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
<widget class="BitcoinAmountField" name="transactionFee"/>
</item>
<item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>per kilobyte</string>
+ </property>
+ </widget>
+ </item>
+ <item>
<spacer name="horizontalSpacer_Main">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
- <width>20</width>
- <height>40</height>
+ <width>17</width>
+ <height>153</height>
</size>
</property>
</spacer>
<context>
<name>QObject</name>
<message>
+ <source>Amount</source>
+ <translation>Количество</translation>
+ </message>
+ <message>
+ <source>NovaCoins</source>
+ <translation>NovaCoins</translation>
+ </message>
+ <message>
+ <source>Milli-NovaCoins (1 / 1,000)</source>
+ <translation>Милли-NovaCoins (1 / 1000)</translation>
+ </message>
+ <message>
+ <source>Micro-NovaCoins (1 / 1,000,000)</source>
+ <translation>Микро-NovaCoins (1 / 1000000)</translation>
+ </message>
+ <message>
<source>from %1 to %2</source>
<translation>от %1 до %2</translation>
</message>
</message>
<message>
<location line="+6"/>
- <source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB. Fee 0.01 recommended.</source>
- <translation>Опциональная комиссия за каждый КБ транзакции, которая позволяет быть уверенным, что Ваша транзакция будет обработана быстро. Большинство транзакций занимают 1КБ. Рекомендуется комиссия 0.01.</translation>
+ <source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB. Fee 0.001 recommended.</source>
+ <translation>Опциональная комиссия за каждый КБ транзакции, которая позволяет быть уверенным, что Ваша транзакция будет обработана быстро. Большинство транзакций занимают 1КБ. Рекомендуется комиссия 0.001.</translation>
</message>
<message>
<location line="+15"/>
<translation>Заплатить ко&миссию</translation>
</message>
<message>
+ <location line="67"/>
+ <source>per kilobyte</source>
+ <translation>за килобайт</translation>
+ </message>
+ <message>
<location line="+31"/>
<source>Automatically start NovaCoin after logging in to the system.</source>
<translation>Автоматически запускать NovaCoin после входа в систему</translation>
<source>Address</source>
<translation>Адрес</translation>
</message>
- <message>
- <location line="+0"/>
- <source>Amount</source>
- <translation>Количество</translation>
- </message>
<message numerus="yes">
<location line="+57"/>
<source>Open for %n block(s)</source>
priv(new TransactionTablePriv(wallet, this)),
cachedNumBlocks(0)
{
- columns << QString() << tr("Date") << tr("Type") << tr("Address") << tr("Amount");
+ columns << QString() << tr("Date") << tr("Type") << tr("Address") << BitcoinUnits::getAmountColumnTitle(walletModel->getOptionsModel()->getDisplayUnit());
priv->refreshWallet();
delete priv;
}
+/** Updates the column title to "Amount (DisplayUnit)" and emits headerDataChanged() signal for table headers to react. */
+void TransactionTableModel::updateAmountColumnTitle()
+{
+ columns[Amount] = BitcoinUnits::getAmountColumnTitle(walletModel->getOptionsModel()->getDisplayUnit());
+ emit headerDataChanged(Qt::Horizontal,Amount,Amount);
+}
+
void TransactionTableModel::updateTransaction(const QString &hash, int status)
{
uint256 updated;
void TransactionTableModel::updateDisplayUnit()
{
+ updateAmountColumnTitle();
// emit dataChanged to update Amount column with the current unit
emit dataChanged(index(0, Amount), index(priv->size()-1, Amount));
}
void updateTransaction(const QString &hash, int status);
void updateConfirmations();
void updateDisplayUnit();
+ /** Updates the column title to "Amount (DisplayUnit)" and emits headerDataChanged() signal for table headers to react. */
+ void updateAmountColumnTitle();
friend class TransactionTablePriv;
};
transactionView->horizontalHeader()->setSectionResizeMode(TransactionTableModel::ToAddress, QHeaderView::Stretch);
#endif
transactionView->horizontalHeader()->resizeSection(
- TransactionTableModel::Amount, 100);
+ TransactionTableModel::Amount, 120);
if (model->getOptionsModel() && fShoudAddThirdPartyURL)
{
case OP_DEPTH:
{
// -- stacksize
- CBigNum bn(stack.size());
+ CBigNum bn((uint16_t) stack.size());
stack.push_back(bn.getvch());
}
break;
// (in -- in size)
if (stack.size() < 1)
return false;
- CBigNum bn(stacktop(-1).size());
+ CBigNum bn((uint16_t) stacktop(-1).size());
stack.push_back(bn.getvch());
}
break;
#include "keystore.h"
#include "bignum.h"
-typedef std::vector<unsigned char> valtype;
+typedef std::vector<uint8_t> valtype;
class CTransaction;
const char* GetOpName(opcodetype opcode);
-
-
inline std::string ValueString(const std::vector<unsigned char>& vch)
{
if (vch.size() <= 4)
return str;
}
-
-
-
-
-
-
-
/** Serialized script, used inside transaction inputs and outputs */
-class CScript : public std::vector<unsigned char>
+class CScript : public std::vector<uint8_t>
{
protected:
CScript& push_int64(int64_t n)
{
if (n == -1 || (n >= 1 && n <= 16))
{
- push_back(n + (OP_1 - 1));
+ push_back((uint8_t)n + (OP_1 - 1));
}
else
{
{
if (n >= 1 && n <= 16)
{
- push_back(n + (OP_1 - 1));
+ push_back((uint8_t)n + (OP_1 - 1));
}
else
{
public:
CScript() { }
- CScript(const CScript& b) : std::vector<unsigned char>(b.begin(), b.end()) { }
- CScript(const_iterator pbegin, const_iterator pend) : std::vector<unsigned char>(pbegin, pend) { }
+ CScript(const CScript& b) : std::vector<uint8_t>(b.begin(), b.end()) { }
+ CScript(const_iterator pbegin, const_iterator pend) : std::vector<uint8_t>(pbegin, pend) { }
#ifndef _MSC_VER
- CScript(const unsigned char* pbegin, const unsigned char* pend) : std::vector<unsigned char>(pbegin, pend) { }
+ CScript(const uint8_t* pbegin, const uint8_t* pend) : std::vector<uint8_t>(pbegin, pend) { }
#endif
CScript& operator+=(const CScript& b)
explicit CScript(opcodetype b) { operator<<(b); }
explicit CScript(const uint256& b) { operator<<(b); }
explicit CScript(const CBigNum& b) { operator<<(b); }
- explicit CScript(const std::vector<unsigned char>& b) { operator<<(b); }
-
+ explicit CScript(const std::vector<uint8_t>& b) { operator<<(b); }
CScript& operator<<(int8_t b) { return push_int64(b); }
CScript& operator<<(int16_t b) { return push_int64(b); }
{
if (opcode < 0 || opcode > 0xff)
throw std::runtime_error("CScript::operator<<() : invalid opcode");
- insert(end(), (unsigned char)opcode);
+ insert(end(), (uint8_t)opcode);
return *this;
}
CScript& operator<<(const uint160& b)
{
insert(end(), sizeof(b));
- insert(end(), (unsigned char*)&b, (unsigned char*)&b + sizeof(b));
+ insert(end(), (uint8_t*)&b, (uint8_t*)&b + sizeof(b));
return *this;
}
CScript& operator<<(const uint256& b)
{
insert(end(), sizeof(b));
- insert(end(), (unsigned char*)&b, (unsigned char*)&b + sizeof(b));
+ insert(end(), (uint8_t*)&b, (uint8_t*)&b + sizeof(b));
return *this;
}
CScript& operator<<(const CPubKey& key)
{
- std::vector<unsigned char> vchKey = key.Raw();
+ std::vector<uint8_t> vchKey = key.Raw();
return (*this) << vchKey;
}
else if (b.size() <= 0xffff)
{
insert(end(), OP_PUSHDATA2);
- uint16_t nSize = b.size();
- insert(end(), (unsigned char*)&nSize, (unsigned char*)&nSize + sizeof(nSize));
+ uint16_t nSize = (uint16_t) b.size();
+ insert(end(), (uint8_t*)&nSize, (uint8_t*)&nSize + sizeof(nSize));
}
else
{
insert(end(), OP_PUSHDATA4);
- uint32_t nSize = b.size();
- insert(end(), (unsigned char*)&nSize, (unsigned char*)&nSize + sizeof(nSize));
+ uint32_t nSize = (uint32_t) b.size();
+ insert(end(), (uint8_t*)&nSize, (uint8_t*)&nSize + sizeof(nSize));
}
insert(end(), b.begin(), b.end());
return *this;
}
- bool GetOp(iterator& pc, opcodetype& opcodeRet, std::vector<unsigned char>& vchRet)
+ bool GetOp(iterator& pc, opcodetype& opcodeRet, std::vector<uint8_t>& vchRet)
{
// Wrapper so it can be called with either iterator or const_iterator
const_iterator pc2 = pc;
return fRet;
}
- bool GetOp(const_iterator& pc, opcodetype& opcodeRet, std::vector<unsigned char>& vchRet) const
+ bool GetOp(const_iterator& pc, opcodetype& opcodeRet, std::vector<uint8_t>& vchRet) const
{
return GetOp2(pc, opcodeRet, &vchRet);
}
return GetOp2(pc, opcodeRet, NULL);
}
- bool GetOp2(const_iterator& pc, opcodetype& opcodeRet, std::vector<unsigned char>* pvchRet) const
+ bool GetOp2(const_iterator& pc, opcodetype& opcodeRet, std::vector<uint8_t>* pvchRet) const
{
opcodeRet = OP_INVALIDOPCODE;
if (pvchRet)
// Read instruction
if (end() - pc < 1)
return false;
- unsigned int opcode = *pc++;
+ uint32_t opcode = *pc++;
// Immediate operand
if (opcode <= OP_PUSHDATA4)
{
- unsigned int nSize;
+ uint32_t nSize;
if (opcode < OP_PUSHDATA1)
{
nSize = opcode;
memcpy(&nSize, &pc[0], 4);
pc += 4;
}
- if (end() - pc < 0 || (unsigned int)(end() - pc) < nSize)
+ if (end() - pc < 0 || (uint32_t)(end() - pc) < nSize)
return false;
if (pvchRet)
pvchRet->assign(pc, pc + nSize);
{
std::string str;
opcodetype opcode;
- std::vector<unsigned char> vch;
+ std::vector<uint8_t> vch;
const_iterator pc = begin();
while (pc < end())
{