Merge pull request #411 from UdjinM6/v0.12.0.x_various_small_fixes

V0.12.0.x various small fixes
This commit is contained in:
evan82 2015-07-08 07:19:41 -07:00
commit 2a3b96e020
6 changed files with 14 additions and 16 deletions

View File

@ -28,7 +28,7 @@ bool CCoinbasePayeeDB::Write(const CCoinbasePayee& objToSave)
// serialize, checksum data up to that point, then append checksum // serialize, checksum data up to that point, then append checksum
CDataStream ssObj(SER_DISK, CLIENT_VERSION); CDataStream ssObj(SER_DISK, CLIENT_VERSION);
ssObj << strMagicMessage; // masternode cache file specific magic message ssObj << strMagicMessage; // coinbase payee cache file specific magic message
ssObj << FLATDATA(Params().MessageStart()); // network specific magic number ssObj << FLATDATA(Params().MessageStart()); // network specific magic number
ssObj << objToSave; ssObj << objToSave;
uint256 hash = Hash(ssObj.begin(), ssObj.end()); uint256 hash = Hash(ssObj.begin(), ssObj.end());
@ -102,13 +102,13 @@ CCoinbasePayeeDB::ReadResult CCoinbasePayeeDB::Read(CCoinbasePayee& objToLoad)
unsigned char pchMsgTmp[4]; unsigned char pchMsgTmp[4];
std::string strMagicMessageTmp; std::string strMagicMessageTmp;
try { try {
// de-serialize file header (masternode cache file specific magic message) and .. // de-serialize file header (coinbase payee cache file specific magic message) and ..
ssObj >> strMagicMessageTmp; ssObj >> strMagicMessageTmp;
// ... verify the message matches predefined one // ... verify the message matches predefined one
if (strMagicMessage != strMagicMessageTmp) if (strMagicMessage != strMagicMessageTmp)
{ {
error("%s : Invalid masternode cache magic message", __func__); error("%s : Invalid coinbase payee cache magic message", __func__);
return IncorrectMagicMessage; return IncorrectMagicMessage;
} }
@ -242,4 +242,4 @@ void CCoinbasePayee::CleanUp()
++it; ++it;
} }
} }
} }

View File

@ -242,7 +242,7 @@ int64_t CreateNewLock(CTransaction tx)
CTransactionLock newLock; CTransactionLock newLock;
newLock.nBlockHeight = nBlockHeight; newLock.nBlockHeight = nBlockHeight;
newLock.nExpiration = GetTime()+(60*60); //locks expire after 60 minutes (6 confirmations) newLock.nExpiration = GetTime()+(60*60); //locks expire after 60 minutes (24 confirmations)
newLock.nTimeout = GetTime()+(60*5); newLock.nTimeout = GetTime()+(60*5);
newLock.txHash = tx.GetHash(); newLock.txHash = tx.GetHash();
mapTxLocks.insert(make_pair(tx.GetHash(), newLock)); mapTxLocks.insert(make_pair(tx.GetHash(), newLock));

View File

@ -1662,9 +1662,9 @@ void CheckForkWarningConditionsOnNewFork(CBlockIndex* pindexNewForkTip)
// We define a condition which we should warn the user about as a fork of at least 7 blocks // We define a condition which we should warn the user about as a fork of at least 7 blocks
// who's tip is within 72 blocks (+/- 3 hours if no one mines it) of ours // who's tip is within 72 blocks (+/- 3 hours if no one mines it) of ours
// or a chain that is entirely longer than ours and invalid (note that this should be detected by both)
// We use 7 blocks rather arbitrarily as it represents just under 10% of sustained network // We use 7 blocks rather arbitrarily as it represents just under 10% of sustained network
// hash rate operating on the fork. // hash rate operating on the fork.
// or a chain that is entirely longer than ours and invalid (note that this should be detected by both)
// We define it this way because it allows us to only store the highest fork tip (+ base) which meets // We define it this way because it allows us to only store the highest fork tip (+ base) which meets
// the 7-block condition and from this always have the most-likely-to-cause-warning fork // the 7-block condition and from this always have the most-likely-to-cause-warning fork
if (pfork && (!pindexBestForkTip || (pindexBestForkTip && pindexNewForkTip->nHeight > pindexBestForkTip->nHeight)) && if (pfork && (!pindexBestForkTip || (pindexBestForkTip && pindexNewForkTip->nHeight > pindexBestForkTip->nHeight)) &&

View File

@ -11,7 +11,6 @@
#include "util.h" #include "util.h"
#include "base58.h" #include "base58.h"
#include "main.h" #include "main.h"
#include "masternode.h"
#include "timedata.h" #include "timedata.h"
#define MASTERNODE_NOT_PROCESSED 0 // initial state #define MASTERNODE_NOT_PROCESSED 0 // initial state

View File

@ -143,14 +143,13 @@ public:
bool IsDust(CFeeRate minRelayTxFee) const bool IsDust(CFeeRate minRelayTxFee) const
{ {
// "Dust" is defined in terms of CTransaction::minRelayTxFee, // "Dust" is defined in terms of CTransaction::minRelayTxFee, which has units duffs-per-kilobyte.
// which has units satoshis-per-kilobyte. // If you'd pay more than 1/3 in fees to spend something, then we consider it dust.
// If you'd pay more than 1/3 in fees // A typical txout is 34 bytes big, and will need a CTxIn of at least 148 bytes to spend
// to spend something, then we consider it dust. // i.e. total is 148 + 32 = 182 bytes. Default -minrelaytxfee is 10000 duffs per kB
// A typical txout is 34 bytes big, and will // and that means that fee per txout is 182 * 10000 / 1000 = 1820 duffs.
// need a CTxIn of at least 148 bytes to spend: // So dust is a txout less than 1820 *3 = 5460 duffs
// so dust is a txout less than 546 satoshis // with default -minrelaytxfee = minRelayTxFee = 10000 duffs per kB.
// with default minRelayTxFee.
size_t nSize = GetSerializeSize(SER_DISK,0)+148u; size_t nSize = GetSerializeSize(SER_DISK,0)+148u;
return (nValue < 3*minRelayTxFee.GetFee(nSize)); return (nValue < 3*minRelayTxFee.GetFee(nSize));
} }

View File

@ -346,7 +346,7 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
strHTML += QString::fromStdString(CBitcoinAddress(address).ToString()); strHTML += QString::fromStdString(CBitcoinAddress(address).ToString());
} }
strHTML = strHTML + " " + tr("Amount") + "=" + BitcoinUnits::formatHtmlWithUnit(unit, vout.nValue); strHTML = strHTML + " " + tr("Amount") + "=" + BitcoinUnits::formatHtmlWithUnit(unit, vout.nValue);
strHTML = strHTML + " IsMine=" + (wallet->IsMine(vout) & ISMINE_SPENDABLE ? tr("true") : tr("false")) + "</li>"; strHTML = strHTML + " IsMine=" + (wallet->IsMine(vout) & ISMINE_SPENDABLE ? tr("true") : tr("false"));
strHTML = strHTML + " IsWatchOnly=" + (wallet->IsMine(vout) & ISMINE_WATCH_ONLY ? tr("true") : tr("false")) + "</li>"; strHTML = strHTML + " IsWatchOnly=" + (wallet->IsMine(vout) & ISMINE_WATCH_ONLY ? tr("true") : tr("false")) + "</li>";
} }
} }