Merge branch 'v0.11.2.x' of https://github.com/darkcoin/darkcoin into v0.11.2.x

This commit is contained in:
Evan Duffield 2015-03-26 07:25:05 -07:00
commit 6eae1071dc
10 changed files with 71 additions and 42 deletions

View File

@ -1159,7 +1159,13 @@ bool AppInit2(boost::thread_group& threadGroup)
if (readResult == CMasternodeDB::FileError) if (readResult == CMasternodeDB::FileError)
LogPrintf("Missing masternode cache file - mncache.dat, will try to recreate\n"); LogPrintf("Missing masternode cache file - mncache.dat, will try to recreate\n");
else if (readResult != CMasternodeDB::Ok) else if (readResult != CMasternodeDB::Ok)
LogPrintf("Masternode cache file mncache.dat has invalid format\n"); {
LogPrintf("Error reading mncache.dat: ");
if(readResult == CMasternodeDB::IncorrectFormat)
LogPrintf("magic is ok but data has invalid format, will try to recreate\n");
else
LogPrintf("file format is unknown or invalid, please fix it manually\n");
}
fMasterNode = GetBoolArg("-masternode", false); fMasterNode = GetBoolArg("-masternode", false);
if(fMasterNode) { if(fMasterNode) {

View File

@ -40,15 +40,17 @@ struct CompareValueOnlyMN
CMasternodeDB::CMasternodeDB() CMasternodeDB::CMasternodeDB()
{ {
pathMN = GetDataDir() / "mncache.dat"; pathMN = GetDataDir() / "mncache.dat";
strMagicMessage = "MasternodeCache";
} }
bool CMasternodeDB::Write(const CMasternodeMan& mnodemanToSave) bool CMasternodeDB::Write(const CMasternodeMan& mnodemanToSave)
{ {
int64_t nStart = GetTimeMillis(); int64_t nStart = GetTimeMillis();
// serialize addresses, checksum data up to that point, then append csum // serialize, checksum data up to that point, then append checksum
CDataStream ssMasternodes(SER_DISK, CLIENT_VERSION); CDataStream ssMasternodes(SER_DISK, CLIENT_VERSION);
ssMasternodes << FLATDATA(Params().MessageStart()); ssMasternodes << strMagicMessage; // masternode cache file specific magic message
ssMasternodes << FLATDATA(Params().MessageStart()); // network specific magic number
ssMasternodes << mnodemanToSave; ssMasternodes << mnodemanToSave;
uint256 hash = Hash(ssMasternodes.begin(), ssMasternodes.end()); uint256 hash = Hash(ssMasternodes.begin(), ssMasternodes.end());
ssMasternodes << hash; ssMasternodes << hash;
@ -119,7 +121,19 @@ CMasternodeDB::ReadResult CMasternodeDB::Read(CMasternodeMan& mnodemanToLoad)
} }
unsigned char pchMsgTmp[4]; unsigned char pchMsgTmp[4];
std::string strMagicMessageTmp;
try { try {
// de-serialize file header (masternode cache file specific magic message) and ..
ssMasternodes >> strMagicMessageTmp;
// ... verify the message matches predefined one
if (strMagicMessage != strMagicMessageTmp)
{
error("%s : Invalid masternode cache magic message", __func__);
return IncorrectMagicMessage;
}
// de-serialize file header (network specific magic number) and .. // de-serialize file header (network specific magic number) and ..
ssMasternodes >> FLATDATA(pchMsgTmp); ssMasternodes >> FLATDATA(pchMsgTmp);
@ -127,10 +141,9 @@ CMasternodeDB::ReadResult CMasternodeDB::Read(CMasternodeMan& mnodemanToLoad)
if (memcmp(pchMsgTmp, Params().MessageStart(), sizeof(pchMsgTmp))) if (memcmp(pchMsgTmp, Params().MessageStart(), sizeof(pchMsgTmp)))
{ {
error("%s : Invalid network magic number", __func__); error("%s : Invalid network magic number", __func__);
return IncorrectMagic; return IncorrectMagicNumber;
} }
// de-serialize data into CMasternodeMan object
// de-serialize address data into one CMnList object
ssMasternodes >> mnodemanToLoad; ssMasternodes >> mnodemanToLoad;
} }
catch (std::exception &e) { catch (std::exception &e) {
@ -160,9 +173,15 @@ void DumpMasternodes()
LogPrintf("Missing masternode cache file - mncache.dat, will try to recreate\n"); LogPrintf("Missing masternode cache file - mncache.dat, will try to recreate\n");
else if (readResult != CMasternodeDB::Ok) else if (readResult != CMasternodeDB::Ok)
{ {
LogPrintf("Masternode cache file mncache.dat has invalid format\n"); LogPrintf("Error reading mncache.dat: ");
if(readResult == CMasternodeDB::IncorrectFormat)
LogPrintf("magic is ok but data has invalid format, will try to recreate\n");
else
{
LogPrintf("file format is unknown or invalid, please fix it manually\n");
return; return;
} }
}
LogPrintf("Writting info to mncache.dat...\n"); LogPrintf("Writting info to mncache.dat...\n");
mndb.Write(mnodeman); mndb.Write(mnodeman);

View File

@ -32,13 +32,15 @@ class CMasternodeDB
{ {
private: private:
boost::filesystem::path pathMN; boost::filesystem::path pathMN;
std::string strMagicMessage;
public: public:
enum ReadResult { enum ReadResult {
Ok, Ok,
FileError, FileError,
HashReadError, HashReadError,
IncorrectHash, IncorrectHash,
IncorrectMagic, IncorrectMagicMessage,
IncorrectMagicNumber,
IncorrectFormat IncorrectFormat
}; };

View File

@ -40,14 +40,14 @@ color:#333;
} }
QToolBar { QToolBar {
background-color:#3D8AC6; background-color:#3398CC;
border:0px solid #000; border:0px solid #000;
padding:0; padding:0;
margin:0; margin:0;
} }
QToolBar > QToolButton { QToolBar > QToolButton {
background-color:#3D8AC6; background-color:#3398CC;
border:0px solid #333; border:0px solid #333;
min-height:2.5em; min-height:2.5em;
padding: 0em 1em; padding: 0em 1em;
@ -101,7 +101,7 @@ background-color:#f2f2f2;
/*******************************************************/ /*******************************************************/
QPushButton { /* Global Button Style */ QPushButton { /* Global Button Style */
background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: .01 #64ACD2, stop: .1 #3D8AC6, stop: .95 #3D8AC6, stop: 1 #1D80B5); background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: .01 #64ACD2, stop: .1 #3398CC, stop: .95 #3398CC, stop: 1 #1D80B5);
border:0; border:0;
border-radius:3px; border-radius:3px;
color:#ffffff; color:#ffffff;
@ -114,7 +114,7 @@ padding-bottom:5px;
} }
QPushButton:hover { QPushButton:hover {
background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: .01 #64ACD2, stop: .1 #4895d1, stop: .95 #4895d1, stop: 1 #1D80B5); background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: .01 #64ACD2, stop: .1 #46AADE, stop: .95 #46AADE, stop: 1 #1D80B5);
} }
QPushButton:focus { QPushButton:focus {
@ -139,7 +139,7 @@ background:#f2f2f2;
} }
QComboBox:editable { QComboBox:editable {
background: #3D8AC6; background: #3398CC;
color:#616161; color:#616161;
border:0px solid transparent; border:0px solid transparent;
} }
@ -234,7 +234,7 @@ background-color:transparent;
QHeaderView::section { /* Table Header Sections */ QHeaderView::section { /* Table Header Sections */
qproperty-alignment:center; qproperty-alignment:center;
background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.25, stop: 0 #4c97bf, stop: 1 #5FA2D6); background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.25, stop: 0 #4c97bf, stop: 1 #56ABD8);
color:#fff; color:#fff;
min-height:25px; min-height:25px;
font-weight:bold; font-weight:bold;
@ -677,11 +677,11 @@ padding-right:5px;
/* OVERVIEW SCREEN */ /* OVERVIEW SCREEN */
QWidget .QFrame#frame { /* Wallet Balance */ QWidget .QFrame#frame { /* Wallet Balance */
min-width:490px;
} }
QWidget .QFrame#frame > .QLabel { QWidget .QFrame#frame > .QLabel {
min-width:175px; min-width:190px;
font-weight:normal; font-weight:normal;
min-height:30px; min-height:30px;
} }
@ -703,7 +703,7 @@ margin-left:20px;
QWidget .QFrame#frame .QLabel#label { /* Available Balance Label */ QWidget .QFrame#frame .QLabel#label { /* Available Balance Label */
qproperty-alignment: 'AlignVCenter | AlignRight'; qproperty-alignment: 'AlignVCenter | AlignRight';
min-width:230px; min-width:230px;
background-color:#5FA2D6; background-color:#56ABD8;
color:#ffffff; color:#ffffff;
margin-right:5px; margin-right:5px;
padding-right:5px; padding-right:5px;
@ -714,10 +714,10 @@ min-height:35px;
QWidget .QFrame#frame .QLabel#labelBalance { /* Available Balance */ QWidget .QFrame#frame .QLabel#labelBalance { /* Available Balance */
qproperty-alignment: 'AlignVCenter | AlignLeft'; qproperty-alignment: 'AlignVCenter | AlignLeft';
font-size:17px; font-size:16px;
font-weight:bold; font-weight:bold;
color:#5FA2D6; color:#56ABD8;
margin-left:13px; margin-left:14px;
} }
QWidget .QFrame#frame .QLabel#label_3 { /* Pending Balance Label */ QWidget .QFrame#frame .QLabel#label_3 { /* Pending Balance Label */
@ -763,22 +763,23 @@ margin-left:16px;
QWidget .QFrame#frameDarksend { /* Darksend Widget */ QWidget .QFrame#frameDarksend { /* Darksend Widget */
background-color:transparent; background-color:transparent;
qproperty-minimumSize: 451px 330px; qproperty-minimumSize: 451px 343px;
} }
QWidget .QFrame#frameDarksend QWidget { QWidget .QFrame#frameDarksend QWidget {
qproperty-geometry: rect(10 0 431 22); qproperty-geometry: rect(10 0 431 35);
} }
QWidget .QFrame#frameDarksend .QLabel#label_2 { /* Darksend Header */ QWidget .QFrame#frameDarksend .QLabel#label_2 { /* Darksend Header */
qproperty-alignment: 'AlignVCenter | AlignRight'; qproperty-alignment: 'AlignVCenter | AlignRight';
min-width:230px; min-width:230px;
color:#3D8AC6; background-color:#56ABD8;
color:#fff;
margin-right:5px; margin-right:5px;
padding-right:5px; padding-right:5px;
font-weight:bold; font-weight:bold;
font-size:16px; font-size:16px;
min-height:22px; min-height:35px;
} }
QWidget .QFrame#frameDarksend .QLabel#labelDarksendSyncStatus { /* Darksend Sync Status */ QWidget .QFrame#frameDarksend .QLabel#labelDarksendSyncStatus { /* Darksend Sync Status */
@ -787,7 +788,7 @@ margin-left:20px;
} }
QWidget .QFrame#frameDarksend #formLayoutWidget { QWidget .QFrame#frameDarksend #formLayoutWidget {
qproperty-geometry: rect(10 38 451 175); qproperty-geometry: rect(10 51 451 175);
} }
QWidget .QFrame#frameDarksend #formLayoutWidget > .QLabel { QWidget .QFrame#frameDarksend #formLayoutWidget > .QLabel {
@ -827,7 +828,7 @@ color:#818181;
} }
QWidget .QFrame#frameDarksend #formLayoutWidget .QProgressBar#darksendProgress::chunk { QWidget .QFrame#frameDarksend #formLayoutWidget .QProgressBar#darksendProgress::chunk {
background-color: #3D8AC6; background-color: #3398CC;
width:10px; width:10px;
} }
@ -869,7 +870,7 @@ QWidget .QFrame#frameDarksend #formLayoutWidget .QLabel#labelSubmittedDenom { /*
QWidget .QFrame#frameDarksend .QLabel#darksendStatus { /* Darksend Status Notifications */ QWidget .QFrame#frameDarksend .QLabel#darksendStatus { /* Darksend Status Notifications */
qproperty-alignment: 'AlignVCenter | AlignCenter'; qproperty-alignment: 'AlignVCenter | AlignCenter';
qproperty-geometry: rect(70 213 395 34); qproperty-geometry: rect(70 226 395 34);
font-size:11px; font-size:11px;
color:#818181; color:#818181;
} }
@ -890,7 +891,7 @@ qproperty-geometry: rect(0 0 0 0);
} }
QWidget .QFrame#frameDarksend .QPushButton#toggleDarksend { /* Start Darksend Mixing */ QWidget .QFrame#frameDarksend .QPushButton#toggleDarksend { /* Start Darksend Mixing */
qproperty-geometry: rect(120 255 295 40); qproperty-geometry: rect(115 268 295 40);
font-size:17px; font-size:17px;
font-weight:bold; font-weight:bold;
color:#ffffff; color:#ffffff;
@ -905,7 +906,7 @@ QWidget .QFrame#frameDarksend .QPushButton#toggleDarksend:hover {
} }
QWidget .QFrame#frameDarksend .QPushButton#darksendAuto { /* Try Mix Button */ QWidget .QFrame#frameDarksend .QPushButton#darksendAuto { /* Try Mix Button */
qproperty-geometry: rect(125 301 140 25); qproperty-geometry: rect(120 314 140 25);
background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: .01 #f6f6f6, stop: .1 rgba(250, 250, 250, 128), stop: .95 rgba(250, 250, 250, 255), stop: 1 #ebebeb); background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: .01 #f6f6f6, stop: .1 rgba(250, 250, 250, 128), stop: .95 rgba(250, 250, 250, 255), stop: 1 #ebebeb);
border:1px solid #d2d2d2; border:1px solid #d2d2d2;
color:#616161; color:#616161;
@ -924,7 +925,7 @@ border:1px solid #9e9e9e;
} }
QWidget .QFrame#frameDarksend .QPushButton#darksendReset { /* Reset Button */ QWidget .QFrame#frameDarksend .QPushButton#darksendReset { /* Reset Button */
qproperty-geometry: rect(270 301 140 25); qproperty-geometry: rect(265 314 140 25);
background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: .01 #f6f6f6, stop: .1 rgba(250, 250, 250, 128), stop: .95 rgba(250, 250, 250, 255), stop: 1 #ebebeb); background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: .01 #f6f6f6, stop: .1 rgba(250, 250, 250, 128), stop: .95 rgba(250, 250, 250, 255), stop: 1 #ebebeb);
border:1px solid #d2d2d2; border:1px solid #d2d2d2;
color:#616161; color:#616161;
@ -945,15 +946,16 @@ border:1px solid #9e9e9e;
/* RECENT TRANSACTIONS */ /* RECENT TRANSACTIONS */
QWidget .QFrame#frame_2 { /* Transactions Widget */ QWidget .QFrame#frame_2 { /* Transactions Widget */
min-width:410px;
margin-right:20px; margin-right:20px;
margin-left:20px; margin-left:0;
background-image: url(':/images/dash_logo_horizontal'); background-image: url(':/images/dash_logo_horizontal');
background-repeat:none; background-repeat:none;
} }
QWidget .QFrame#frame_2 .QLabel#label_4 { /* Recent Transactions Label */ QWidget .QFrame#frame_2 .QLabel#label_4 { /* Recent Transactions Label */
min-width:200px; min-width:200px;
color:#3D8AC6; color:#3398CC;
margin-left:67px; margin-left:67px;
margin-top:123px; margin-top:123px;
margin-right:5px; margin-right:5px;
@ -994,7 +996,7 @@ min-height:25px;
} }
QDialog#SendCoinsDialog .QFrame#frameCoinControl .QLabel#labelCoinControlFeatures { /* Coin Control Header */ QDialog#SendCoinsDialog .QFrame#frameCoinControl .QLabel#labelCoinControlFeatures { /* Coin Control Header */
color:#3D8AC6; color:#3398CC;
font-weight:bold; font-weight:bold;
font-size:14px; font-size:14px;
} }
@ -1101,7 +1103,7 @@ min-height:27px;
QDialog#SendCoinsDialog QLabel#labelBalance { QDialog#SendCoinsDialog QLabel#labelBalance {
margin-left:0px; margin-left:0px;
padding-left:0px; padding-left:0px;
color:#616161; color:#333333;
/* font-weight:bold; /* font-weight:bold;
border-radius:5px; border-radius:5px;
padding-top:20px; padding-top:20px;
@ -1113,7 +1115,7 @@ min-height:27px;
/* SEND COINS ENTRY */ /* SEND COINS ENTRY */
QStackedWidget#SendCoinsEntry .QFrame#SendCoins > .QLabel { /* Send Coin Entry Labels */ QStackedWidget#SendCoinsEntry .QFrame#SendCoins > .QLabel { /* Send Coin Entry Labels */
background-color:#5FA2D6; background-color:#56ABD8;
min-width:102px; min-width:102px;
font-weight:bold; font-weight:bold;
font-size:11px; font-size:11px;
@ -1294,7 +1296,7 @@ QDialog#CoinControlDialog .CoinControlTreeWidget#treeWidget::indicator { /* Coin
/* RECEIVE COINS */ /* RECEIVE COINS */
QWidget#ReceiveCoinsDialog .QFrame#frame2 .QLabel#label_2 { /* Label Label */ QWidget#ReceiveCoinsDialog .QFrame#frame2 .QLabel#label_2 { /* Label Label */
background-color:#5FA2D6; background-color:#56ABD8;
min-width:102px; min-width:102px;
color:#ffffff; color:#ffffff;
font-weight:bold; font-weight:bold;
@ -1312,7 +1314,7 @@ padding-right:5px;
} }
QWidget#ReceiveCoinsDialog .QFrame#frame2 .QLabel#label_3 { /* Message Label */ QWidget#ReceiveCoinsDialog .QFrame#frame2 .QLabel#label_3 { /* Message Label */
background-color:#5FA2D6; background-color:#56ABD8;
min-width:102px; min-width:102px;
color:#ffffff; color:#ffffff;
font-weight:bold; font-weight:bold;
@ -1372,7 +1374,7 @@ border:1px solid #9e9e9e;
} }
QWidget#ReceiveCoinsDialog .QFrame#frame .QLabel#label_6 { /* Requested Payments History Label */ QWidget#ReceiveCoinsDialog .QFrame#frame .QLabel#label_6 { /* Requested Payments History Label */
color:#3D8AC6; color:#3398CC;
font-weight:bold; font-weight:bold;
font-size:14px; font-size:14px;
} }

BIN
src/qt/res/images/about.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

BIN
src/qt/res/images/splash.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 KiB

After

Width:  |  Height:  |  Size: 138 KiB

BIN
src/qt/res/images/splash_testnet.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 157 KiB

After

Width:  |  Height:  |  Size: 155 KiB

4
src/qt/rpcconsole.cpp Normal file → Executable file
View File

@ -391,8 +391,8 @@ void RPCConsole::on_lineEdit_returnPressed()
{ {
message(CMD_REQUEST, cmd); message(CMD_REQUEST, cmd);
emit cmdRequest(cmd); emit cmdRequest(cmd);
// Truncate history from current position // Remove command, if already in history
history.erase(history.begin() + historyPtr, history.end()); history.removeOne(cmd);
// Append command to history // Append command to history
history.append(cmd); history.append(cmd);
// Enforce maximum history size // Enforce maximum history size

View File

@ -33,7 +33,7 @@ static const int PROTOCOL_VERSION = 70075;
static const int INIT_PROTO_VERSION = 209; static const int INIT_PROTO_VERSION = 209;
// disconnect from peers older than this proto version // disconnect from peers older than this proto version
static const int MIN_PEER_PROTO_VERSION = 70054; static const int MIN_PEER_PROTO_VERSION = 70066;
// nTime field added to CAddress, starting with this version; // nTime field added to CAddress, starting with this version;
// if possible, avoid requesting addresses nodes older than this // if possible, avoid requesting addresses nodes older than this