// Calculate G*m + q
bool ECMULGEN(const CBigNum &bnMultiplier, const CPoint &qPoint);
- bool IsInfinity() { return EC_POINT_is_at_infinity(group, point); }
+ bool IsInfinity() { return EC_POINT_is_at_infinity(group, point) != 0; }
};
class CMalleablePubKey
return DoS(100, error("AcceptBlock() : incorrect %s", IsProofOfWork() ? "proof-of-work" : "proof-of-stake"));
int64_t nMedianTimePast = pindexPrev->GetMedianTimePast();
- int nMaxOffset = 12 * 3600; // 12 hours
+ int nMaxOffset = 12 * nOneHour; // 12 hours
if (fTestNet || pindexPrev->nTime < 1450569600)
- nMaxOffset = 7 * 86400; // One week (permanently on testNet or until 20 Dec, 2015 on mainNet)
+ nMaxOffset = 7 * nOneWeek; // One week (permanently on testNet or until 20 Dec, 2015 on mainNet)
// Check timestamp against prev
if (GetBlockTime() <= nMedianTimePast || FutureDrift(GetBlockTime()) < pindexPrev->GetBlockTime())
// it'll get a pile of addresses with newer timestamps.
// Seed nodes are given a random 'last seen time' of between one and two
// weeks ago.
- const int64_t nOneWeek = 7*24*60*60;
struct in_addr ip;
memcpy(&ip, &pnSeed[i], sizeof(ip));
CAddress addr(CService(ip, GetDefaultPort()));
std::vector<CAddress> vAdd;
for (unsigned int i = 0; i < ARRAYLEN(pchTorSeed); i++)
{
- const int64_t nOneWeek = 7*24*60*60;
CAddress addr(CService(pchTorSeed[i], GetDefaultPort()));
addr.nTime = GetTime()-GetRand(nOneWeek)-nOneWeek;
vAdd.push_back(addr);
CloseSocket(hSocket);
return error("Hostname too long");
}
- char pszSocks5Init[] = "\5\1\0";
- ssize_t nSize = sizeof(pszSocks5Init) - 1;
-
- ssize_t ret = send(hSocket, pszSocks5Init, nSize, MSG_NOSIGNAL);
- if (ret != nSize)
+ const char pszSocks5Init[] = "\5\1\0";
+ ssize_t ret = send(hSocket, pszSocks5Init, 3, MSG_NOSIGNAL);
+ if (ret != 3)
{
CloseSocket(hSocket);
return error("Error sending to proxy");
#endif
hSocket = INVALID_SOCKET;
return ret != SOCKET_ERROR;
-}
\ No newline at end of file
+}
static const unsigned int MAX_SCRIPT_ELEMENT_SIZE = 520; // bytes
-/* Setting nSequence to this value for every input in a transaction
- * disables nLockTime. */
+// Setting nSequence to this value for every input in a transaction
+// disables nLockTime.
static const uint32_t SEQUENCE_FINAL = 0xffffffff;
-/* Threshold for inverted nSequence: below this value it is interpreted
- * as a relative lock-time, otherwise ignored. */
-static const uint32_t SEQUENCE_THRESHOLD = (1 << 31);
+// Threshold for inverted nSequence: below this value it is interpreted
+// as a relative lock-time, otherwise ignored.
+//static const uint32_t SEQUENCE_THRESHOLD = 0x80000000;
-/* If this flag set, CTxIn::nSequence is NOT interpreted as a
- * relative lock-time. */
-static const uint32_t SEQUENCE_LOCKTIME_DISABLE_FLAG = (1 << 31);
+// If this flag set, CTxIn::nSequence is NOT interpreted as a
+// relative lock-time.
+static const uint32_t SEQUENCE_LOCKTIME_DISABLE_FLAG = 0x80000000;
-/* If CTxIn::nSequence encodes a relative lock-time and this flag
- * is set, the relative lock-time has units of 512 seconds,
- * otherwise it specifies blocks with a granularity of 1. */
-static const uint32_t SEQUENCE_LOCKTIME_TYPE_FLAG = (1 << 22);
+// If CTxIn::nSequence encodes a relative lock-time and this flag
+// is set, the relative lock-time has units of 512 seconds,
+// otherwise it specifies blocks with a granularity of 1.
+static const uint32_t SEQUENCE_LOCKTIME_TYPE_FLAG = 0x00400000;
-/* If CTxIn::nSequence encodes a relative lock-time, this mask is
- * applied to extract that lock-time from the sequence field. */
+// If CTxIn::nSequence encodes a relative lock-time, this mask is
+// applied to extract that lock-time from the sequence field.
static const uint32_t SEQUENCE_LOCKTIME_MASK = 0x0000ffff;
-/** IsMine() return codes */
+// IsMine() return codes
enum isminetype
{
MINE_NO = 0,
typedef uint8_t isminefilter;
-/** Signature hash types/flags */
+// Signature hash types/flags
enum
{
SIGHASH_ALL = 1,
SIGHASH_ANYONECANPAY = 0x80
};
-/** Script verification flags */
+// Script verification flags
enum
{
SCRIPT_VERIFY_NONE = 0,
SCRIPT_VERIFY_STRICTENC = (1U << 1), // enforce strict conformance to DER and SEC2 for signatures and pubkeys
SCRIPT_VERIFY_LOW_S = (1U << 2), // enforce low S values in signatures (depends on STRICTENC)
SCRIPT_VERIFY_NOCACHE = (1U << 3), // do not store results in signature cache (but do query it)
- SCRIPT_VERIFY_NULLDUMMY = (1U << 4), // verify dummy stack item consumed by CHECKMULTISIG is of zero-length
+ SCRIPT_VERIFY_NULLDUMMY = (1U << 4), // verify dummy stack item consumed by CHECKMULTISIG is of zero-length
SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY = (1U << 9),
SCRIPT_VERIFY_CHECKSEQUENCEVERIFY = (1U << 10)
};
const char* GetTxnOutputType(txnouttype t);
-/** Script opcodes */
+// Script opcodes
enum opcodetype
{
// push value
return str;
}
-/** Serialized script, used inside transaction inputs and outputs */
+// Serialized script, used inside transaction inputs and outputs
class CScript : public std::vector<uint8_t>
{
protected:
string str = strprintf("%" PRId64 ".%06" PRId64, quotient, remainder);
// Right-trim excess zeros before the decimal point:
- int nTrim = 0;
+ size_t nTrim = 0;
for (size_t i = str.size()-1; (str[i] == '0' && isdigit(str[i-2])); --i)
++nTrim;
if (nTrim)
str.erase(str.size()-nTrim, nTrim);
if (n < 0)
- str.insert((unsigned int)0, 1, '-');
+ str.insert(0u, 1, '-');
else if (fPlus && n > 0)
- str.insert((unsigned int)0, 1, '+');
+ str.insert(0u, 1, '+');
return str;
}
ss.imbue(loc);
ss << boost::posix_time::from_time_t(nTime);
return ss.str();
-}
\ No newline at end of file
+}
static const int32_t nOneHour = 60 * 60;
static const int32_t nOneDay = 24 * 60 * 60;
+static const int64_t nOneWeek = 7 * 24 * 60 * 60;
static const int64_t COIN = 1000000;
static const int64_t CENT = 10000;
AddToWallet(wtxNew);
// Mark old coins as spent
- set<CWalletTx*> setCoins;
BOOST_FOREACH(const CTxIn& txin, wtxNew.vin)
{
CWalletTx &coin = mapWallet[txin.prevout.hash];