Merge pull request #536 from dashpay/master

merge master back to v12 branch
This commit is contained in:
Holger Schinzel 2015-08-16 00:44:30 +02:00
commit cfbcc81a36
40 changed files with 5050 additions and 107663 deletions

View File

@ -74,7 +74,7 @@ def check_format_specifiers(source, translation, errors):
source_f = split_format_specifiers(find_format_specifiers(source))
# assert that no source messages contain both Qt and strprintf format specifiers
# if this fails, go change the source as this is hacky and confusing!
assert(not(source_f[0] and source_f[1]))
#assert(not(source_f[0] and source_f[1]))
try:
translation_f = split_format_specifiers(find_format_specifiers(translation))
except IndexError:
@ -181,6 +181,6 @@ def postprocess_translations(reduce_diff_hacks=False):
if __name__ == '__main__':
check_at_repository_root()
fetch_all_translations()
# fetch_all_translations()
postprocess_translations()

View File

@ -3,34 +3,19 @@ EXTRA_LIBRARIES += qt/libbitcoinqt.a
# dash qt core #
QT_TS = \
qt/locale/dash_bar.ts \
qt/locale/dash_bg.ts \
qt/locale/dash_ca.ts \
qt/locale/dash_cmn.ts \
qt/locale/dash_cs.ts \
qt/locale/dash_da.ts \
qt/locale/dash_de.ts \
qt/locale/dash_el.ts \
qt/locale/dash_en.ts \
qt/locale/dash_eo.ts \
qt/locale/dash_es.ts \
qt/locale/dash_fi.ts \
qt/locale/dash_fr.ts \
qt/locale/dash_hu_HU.ts \
qt/locale/dash_it.ts \
qt/locale/dash_lv_LV.ts \
qt/locale/dash_nb.ts \
qt/locale/dash_nl.ts \
qt/locale/dash_pl.ts \
qt/locale/dash_pt.ts \
qt/locale/dash_pt_BR.ts \
qt/locale/dash_ru.ts \
qt/locale/dash_sk.ts \
qt/locale/dash_sv.ts \
qt/locale/dash_tr.ts \
qt/locale/dash_vi.ts \
qt/locale/dash_zh_CN.ts \
qt/locale/dash_zh_HK.ts
qt/locale/dash_zh_TW.ts
QT_FORMS_UI = \
qt/forms/addressbookpage.ui \

View File

@ -348,6 +348,9 @@ bool CActiveMasternode::GetMasterNodeVin(CTxIn& vin, CPubKey& pubkey, CKey& secr
bool CActiveMasternode::GetMasterNodeVin(CTxIn& vin, CPubKey& pubkey, CKey& secretKey, std::string strTxHash, std::string strOutputIndex) {
// Find possible candidates
TRY_LOCK(pwalletMain->cs_wallet, fWallet);
if(!fWallet) return false;
vector<COutput> possibleCoins = SelectCoinsMasternode();
COutput *selectedOutput;

View File

@ -362,6 +362,8 @@ void CMasternodePayments::ProcessMessageMasternodePayments(CNode* pfrom, std::st
CMasternodePaymentWinner winner;
vRecv >> winner;
if(pfrom->nVersion < MIN_MNW_PEER_PROTO_VERSION) return;
if(chainActive.Tip() == NULL) return;
if(masternodePayments.mapMasternodePayeeVotes.count(winner.GetHash())){

View File

@ -9,6 +9,7 @@
#include "masternode-budget.h"
#include "masternode.h"
#include "masternodeman.h"
#include "spork.h"
#include "util.h"
#include "addrman.h"
@ -76,6 +77,7 @@ void CMasternodeSync::Reset()
countBudgetItemFin = 0;
RequestedMasternodeAssets = MASTERNODE_SYNC_INITIAL;
RequestedMasternodeAttempt = 0;
nAssetSyncStarted = GetTime();
}
void CMasternodeSync::AddedMasternodeList(uint256 hash)
@ -152,8 +154,22 @@ void CMasternodeSync::GetNextAsset()
break;
}
RequestedMasternodeAttempt = 0;
nAssetSyncStarted = GetTime();
}
std::string CMasternodeSync::GetSyncStatus()
{
switch (masternodeSync.RequestedMasternodeAssets) {
case MASTERNODE_SYNC_INITIAL: return _("Synchronization doesn't yet started");
case MASTERNODE_SYNC_SPORKS: return _("Synchronizing sporks...");
case MASTERNODE_SYNC_LIST: return _("Synchronizing masternodes...");
case MASTERNODE_SYNC_MNW: return _("Synchronizing masternode winners...");
case MASTERNODE_SYNC_BUDGET: return _("Synchronizing budgets...");
case MASTERNODE_SYNC_FAILED: return _("Synchronization failed");
case MASTERNODE_SYNC_FINISHED: return _("Synchronization finished");
}
return "";
}
void CMasternodeSync::ProcessMessage(CNode* pfrom, std::string& strCommand, CDataStream& vRecv)
{
@ -284,6 +300,21 @@ void CMasternodeSync::Process()
if(pnode->HasFulfilledRequest("mnsync")) continue;
pnode->FulfilledRequest("mnsync");
// timeout
if(lastMasternodeList == 0 &&
(RequestedMasternodeAttempt >= MASTERNODE_SYNC_THRESHOLD*3 || GetTime() - nAssetSyncStarted > MASTERNODE_SYNC_TIMEOUT*3)) {
if(IsSporkActive(SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT)) {
LogPrintf("CMasternodeSync::Process - ERROR - Sync has failed, will retry later\n");
RequestedMasternodeAssets = MASTERNODE_SYNC_FAILED;
RequestedMasternodeAttempt = 0;
lastFailure = GetTime();
nCountFailures++;
} else {
GetNextAsset();
}
return;
}
mnodeman.DsegUpdate(pnode);
RequestedMasternodeAttempt++;
return;
@ -298,6 +329,21 @@ void CMasternodeSync::Process()
if(pnode->HasFulfilledRequest("mnwsync")) continue;
pnode->FulfilledRequest("mnwsync");
// timeout
if(lastMasternodeWinner == 0 &&
(RequestedMasternodeAttempt >= MASTERNODE_SYNC_THRESHOLD*3 || GetTime() - nAssetSyncStarted > MASTERNODE_SYNC_TIMEOUT*3)) {
if(IsSporkActive(SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT)) {
LogPrintf("CMasternodeSync::Process - ERROR - Sync has failed, will retry later\n");
RequestedMasternodeAssets = MASTERNODE_SYNC_FAILED;
RequestedMasternodeAttempt = 0;
lastFailure = GetTime();
nCountFailures++;
} else {
GetNextAsset();
}
return;
}
CBlockIndex* pindexPrev = chainActive.Tip();
if(pindexPrev == NULL) return;
@ -332,7 +378,9 @@ void CMasternodeSync::Process()
}
// timeout
if(lastBudgetItem == 0 && RequestedMasternodeAttempt >= MASTERNODE_SYNC_THRESHOLD*3) {
if(lastBudgetItem == 0 &&
(RequestedMasternodeAttempt >= MASTERNODE_SYNC_THRESHOLD*3 || GetTime() - nAssetSyncStarted > MASTERNODE_SYNC_TIMEOUT*3)) {
// maybe there is no budgets at all, so just finish syncing
GetNextAsset();
activeMasternode.ManageStatus();
return;

View File

@ -15,7 +15,7 @@
#define MASTERNODE_SYNC_FAILED 998
#define MASTERNODE_SYNC_FINISHED 999
#define MASTERNODE_SYNC_TIMEOUT 7
#define MASTERNODE_SYNC_TIMEOUT 5
#define MASTERNODE_SYNC_THRESHOLD 4
class CMasternodeSync;
@ -53,12 +53,16 @@ public:
int RequestedMasternodeAssets;
int RequestedMasternodeAttempt;
// Time when current masternode asset sync started
int64_t nAssetSyncStarted;
CMasternodeSync();
void AddedMasternodeList(uint256 hash);
void AddedMasternodeWinner(uint256 hash);
void AddedBudgetItem(uint256 hash);
void GetNextAsset();
std::string GetSyncStatus();
void ProcessMessage(CNode* pfrom, std::string& strCommand, CDataStream& vRecv);
bool IsBudgetFinEmpty();
bool IsBudgetPropEmpty();

View File

@ -768,7 +768,7 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
if(vin == CTxIn()) pfrom->PushMessage("ssc", MASTERNODE_SYNC_LIST, (int)vInv.size());
if(vInv.size() > 0) pfrom->PushMessage("inv", vInv);
LogPrintf("dseg - Sent %d Masternode entries to %s\n", i, pfrom->addr.ToString());
if(vin == CTxIn()) LogPrintf("dseg - Sent %d Masternode entries to %s\n", i, pfrom->addr.ToString());
}
/*
* IT'S SAFE TO REMOVE THIS IN FURTHER VERSIONS

View File

@ -758,46 +758,38 @@ void BitcoinGUI::setNumBlocks(int count)
// if(secs < 25*60) // 90*60 for bitcoin but we are 4x times faster
if(masternodeSync.IsBlockchainSynced())
{
QString strSyncStatus;
tooltip = tr("Up to date") + QString(".<br>") + tooltip;
static int prevAttempt = -1;
static int prevAssets = -1;
static int progress = 0;
if(masternodeSync.RequestedMasternodeAttempt != prevAttempt || masternodeSync.RequestedMasternodeAssets != prevAssets)
{
if(masternodeSync.IsSynced()) {
progressBarLabel->setVisible(false);
progressBar->setVisible(false);
labelBlocksIcon->setPixmap(QIcon(":/icons/synced").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
} else {
int nAttempt;
int progress = 0;
labelBlocksIcon->setPixmap(QIcon(QString(
":/movies/spinner-%1").arg(spinnerFrame, 3, 10, QChar('0')))
.pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
spinnerFrame = (spinnerFrame + 1) % SPINNER_FRAMES;
progressBar->setMaximum(4 * MASTERNODE_SYNC_THRESHOLD);
prevAttempt = masternodeSync.RequestedMasternodeAttempt + 1;
prevAssets = masternodeSync.RequestedMasternodeAssets;
if(prevAttempt <= MASTERNODE_SYNC_THRESHOLD) progress = prevAttempt + (prevAssets - 1) * MASTERNODE_SYNC_THRESHOLD;
progressBar->setValue(progress);
#ifdef ENABLE_WALLET
if(walletFrame)
walletFrame->showOutOfSyncWarning(false);
#endif // ENABLE_WALLET
nAttempt = masternodeSync.RequestedMasternodeAttempt < MASTERNODE_SYNC_THRESHOLD ?
masternodeSync.RequestedMasternodeAttempt + 1 : MASTERNODE_SYNC_THRESHOLD;
progress = nAttempt + (masternodeSync.RequestedMasternodeAssets - 1) * MASTERNODE_SYNC_THRESHOLD;
progressBar->setMaximum(4 * MASTERNODE_SYNC_THRESHOLD);
progressBar->setValue(progress);
}
switch (masternodeSync.RequestedMasternodeAssets) {
case MASTERNODE_SYNC_SPORKS:
progressBarLabel->setText(tr("Synchronizing sporks..."));
break;
case MASTERNODE_SYNC_LIST:
progressBarLabel->setText(tr("Synchronizing masternodes..."));
break;
case MASTERNODE_SYNC_MNW:
progressBarLabel->setText(tr("Synchronizing masternode winners..."));
break;
case MASTERNODE_SYNC_BUDGET:
progressBarLabel->setText(tr("Synchronizing budgets..."));
break;
case MASTERNODE_SYNC_FINISHED:
progressBarLabel->setVisible(false);
progressBar->setVisible(false);
labelBlocksIcon->setPixmap(QIcon(":/icons/synced").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
break;
}
strSyncStatus = QString(masternodeSync.GetSyncStatus().c_str());
progressBarLabel->setText(strSyncStatus);
tooltip = strSyncStatus + QString("<br>") + tooltip;
}
else
{

View File

@ -1,32 +1,17 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource prefix="/translations">
<file alias="bar">locale/dash_bar.qm</file>
<file alias="bg">locale/dash_bg.qm</file>
<file alias="ca">locale/dash_ca.qm</file>
<file alias="cmn">locale/dash_cmn.qm</file>
<file alias="cs">locale/dash_cs.qm</file>
<file alias="da">locale/dash_da.qm</file>
<file alias="de">locale/dash_de.qm</file>
<file alias="el">locale/dash_el.qm</file>
<file alias="en">locale/dash_en.qm</file>
<file alias="eo">locale/dash_eo.qm</file>
<file alias="es">locale/dash_es.qm</file>
<file alias="fi">locale/dash_fi.qm</file>
<file alias="fr">locale/dash_fr.qm</file>
<file alias="hu_HU">locale/dash_hu_HU.qm</file>
<file alias="it">locale/dash_it.qm</file>
<file alias="lv_LV">locale/dash_lv_LV.qm</file>
<file alias="nb">locale/dash_nb.qm</file>
<file alias="nl">locale/dash_nl.qm</file>
<file alias="pl">locale/dash_pl.qm</file>
<file alias="pt">locale/dash_pt.qm</file>
<file alias="pt_BR">locale/dash_pt_BR.qm</file>
<file alias="ru">locale/dash_ru.qm</file>
<file alias="sk">locale/dash_sk.qm</file>
<file alias="sv">locale/dash_sv.qm</file>
<file alias="tr">locale/dash_tr.qm</file>
<file alias="vi">locale/dash_vi.qm</file>
<file alias="zh_CN">locale/dash_zh_CN.qm</file>
<file alias="zh_HK">locale/dash_zh_HK.qm</file>
<file alias="zh_TW">locale/dash_zh_TW.qm</file>
</qresource>
</RCC>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

3517
src/qt/locale/dash_zh_TW.ts Normal file

File diff suppressed because it is too large Load Diff

View File

@ -167,8 +167,7 @@ Value masternode(const Array& params, bool fHelp)
if (params.size() == 2){
strAddress = params[1].get_str();
} else {
throw runtime_error(
"Masternode address required\n");
throw runtime_error("Masternode address required\n");
}
CService addr = CService(strAddress);
@ -176,15 +175,14 @@ Value masternode(const Array& params, bool fHelp)
if(ConnectNode((CAddress)addr, NULL, true)){
return "successfully connected";
} else {
return "error connecting";
throw runtime_error("error connecting\n");
}
}
if (strCommand == "count")
{
if (params.size() > 2){
throw runtime_error(
"too many parameters\n");
throw runtime_error("too many parameters\n");
}
if (params.size() == 2)
{
@ -233,7 +231,7 @@ Value masternode(const Array& params, bool fHelp)
CKey key;
bool found = activeMasternode.GetMasterNodeVin(vin, pubkey, key);
if(!found){
return "Missing masternode input, please look at the documentation for instructions on masternode creation";
throw runtime_error("Missing masternode input, please look at the documentation for instructions on masternode creation\n");
} else {
return activeMasternode.GetStatus();
}
@ -246,7 +244,7 @@ Value masternode(const Array& params, bool fHelp)
if (strCommand == "start")
{
if(!fMasterNode) return "you must set masternode=1 in the configuration";
if(!fMasterNode) throw runtime_error("you must set masternode=1 in the configuration\n");
if(pwalletMain->IsLocked()) {
SecureString strWalletPass;
@ -255,12 +253,11 @@ Value masternode(const Array& params, bool fHelp)
if (params.size() == 2){
strWalletPass = params[1].get_str().c_str();
} else {
throw runtime_error(
"Your wallet is locked, passphrase is required\n");
throw runtime_error("Your wallet is locked, passphrase is required\n");
}
if(!pwalletMain->Unlock(strWalletPass)){
return "incorrect passphrase";
throw runtime_error("incorrect passphrase\n");
}
}
@ -276,8 +273,7 @@ Value masternode(const Array& params, bool fHelp)
if (strCommand == "start-alias")
{
if (params.size() < 2){
throw runtime_error(
"command needs at least 2 parameters\n");
throw runtime_error("command needs at least 2 parameters\n");
}
std::string alias = params[1].get_str();
@ -289,12 +285,11 @@ Value masternode(const Array& params, bool fHelp)
if (params.size() == 3){
strWalletPass = params[2].get_str().c_str();
} else {
throw runtime_error(
"Your wallet is locked, passphrase is required\n");
throw runtime_error("Your wallet is locked, passphrase is required\n");
}
if(!pwalletMain->Unlock(strWalletPass)){
return "incorrect passphrase";
throw runtime_error("incorrect passphrase\n");
}
}
@ -337,12 +332,11 @@ Value masternode(const Array& params, bool fHelp)
if (params.size() == 2){
strWalletPass = params[1].get_str().c_str();
} else {
throw runtime_error(
"Your wallet is locked, passphrase is required\n");
throw runtime_error("Your wallet is locked, passphrase is required\n");
}
if(!pwalletMain->Unlock(strWalletPass)){
return "incorrect passphrase";
throw runtime_error("incorrect passphrase\n");
}
}
@ -384,7 +378,7 @@ Value masternode(const Array& params, bool fHelp)
if (strCommand == "create")
{
return "Not implemented yet, please look at the documentation for instructions on masternode creation";
throw runtime_error("Not implemented yet, please look at the documentation for instructions on masternode creation\n");
}
if (strCommand == "genkey")
@ -430,8 +424,7 @@ Value masternode(const Array& params, bool fHelp)
if(strCommand == "status")
{
std::vector<CMasternodeConfig::CMasternodeEntry> mnEntries;
mnEntries = masternodeConfig.getEntries();
if(!fMasterNode) throw runtime_error("This is not a masternode\n");
CScript pubkey;
pubkey = GetScriptForDestination(activeMasternode.pubKeyMasternode.GetID());
@ -442,9 +435,8 @@ Value masternode(const Array& params, bool fHelp)
Object mnObj;
mnObj.push_back(Pair("vin", activeMasternode.vin.ToString()));
mnObj.push_back(Pair("service", activeMasternode.service.ToString()));
mnObj.push_back(Pair("status", activeMasternode.status));
mnObj.push_back(Pair("pubKeyMasternode", address2.ToString()));
mnObj.push_back(Pair("notCapableReason", activeMasternode.notCapableReason));
mnObj.push_back(Pair("status", activeMasternode.GetStatus()));
return mnObj;
}
@ -460,7 +452,7 @@ Value masternode(const Array& params, bool fHelp)
for(int nHeight = chainActive.Tip()->nHeight-nLast; nHeight < chainActive.Tip()->nHeight+20; nHeight++)
{
obj.push_back(Pair(strprintf("%d", nHeight), GetRequiredPaymentsString(nHeight)));
obj.push_back(Pair(strprintf("%d", nHeight), GetRequiredPaymentsString(nHeight)));
}
return obj;
@ -491,7 +483,7 @@ Value masternode(const Array& params, bool fHelp)
}
}
if(pBestMasternode)
obj.push_back(Pair(strprintf("%d", nHeight), pBestMasternode->vin.prevout.ToStringShort().c_str()));
obj.push_back(Pair(strprintf("%d", nHeight), pBestMasternode->vin.prevout.ToStringShort().c_str()));
}
return obj;

View File

@ -101,9 +101,9 @@ bool IsSporkActive(int nSporkID)
}
// grab the value of the spork on the network, or the default
int GetSporkValue(int nSporkID)
int64_t GetSporkValue(int nSporkID)
{
int r = 0;
int64_t r = -1;
if(mapSporksActive.count(nSporkID)){
r = mapSporksActive[nSporkID].nValue;
@ -119,7 +119,7 @@ int GetSporkValue(int nSporkID)
if(nSporkID == SPORK_12_RECONSIDER_BLOCKS) r = SPORK_12_RECONSIDER_BLOCKS_DEFAULT;
if(nSporkID == SPORK_13_ENABLE_SUPERBLOCKS) r = SPORK_13_ENABLE_SUPERBLOCKS_DEFAULT;
if(r == 0) LogPrintf("GetSpork::Unknown Spork %d\n", nSporkID);
if(r == -1) LogPrintf("GetSpork::Unknown Spork %d\n", nSporkID);
}
return r;

View File

@ -56,7 +56,7 @@ extern std::map<int, CSporkMessage> mapSporksActive;
extern CSporkManager sporkManager;
void ProcessSpork(CNode* pfrom, std::string& strCommand, CDataStream& vRecv);
int GetSporkValue(int nSporkID);
int64_t GetSporkValue(int nSporkID);
bool IsSporkActive(int nSporkID);
void ExecuteSpork(int nSporkID, int nValue);
void ReprocessBlocks(int nBlocks);