Skip to content
Permalink
Browse files

Merge pull request #93 from SINOVATEblockchain/development

Master update for v1.06-0.17.1.0
  • Loading branch information...
crptec committed Oct 7, 2019
2 parents 61d6ee4 + 9c41ee5 commit 5778c65e65aa0e737ad66f9d8dad4d1f76b84531
Showing with 251 additions and 6,799 deletions.
  1. +1 −9 src/Makefile.am
  2. +4 −8 src/Makefile.qt.include
  3. +8 −4 src/chainparams.cpp
  4. +0 −13 src/dsnotificationinterface.cpp
  5. +1 −0 src/infinitynode.cpp
  6. +0 −1 src/infinitynodeman.cpp
  7. +65 −33 src/init.cpp
  8. +23 −11 src/instantx.cpp
  9. +4 −3 src/instantx.h
  10. +7 −20 src/interfaces/wallet.cpp
  11. +3 −21 src/interfaces/wallet.h
  12. +0 −1 src/logging.cpp
  13. +0 −1 src/logging.h
  14. +0 −7 src/masternodeman.cpp
  15. +3 −1 src/miner.cpp
  16. +3 −9 src/net.cpp
  17. +6 −66 src/net_processing.cpp
  18. +2 −2 src/primitives/block.cpp
  19. +0 −1,541 src/privatesend-client.cpp
  20. +0 −199 src/privatesend-client.h
  21. +0 −890 src/privatesend-server.cpp
  22. +0 −80 src/privatesend-server.h
  23. +0 −71 src/privatesend-util.cpp
  24. +0 −38 src/privatesend-util.h
  25. +0 −521 src/privatesend.cpp
  26. +0 −393 src/privatesend.h
  27. +0 −17 src/protocol.cpp
  28. +1 −9 src/protocol.h
  29. +1 −10 src/qt/askpassphrasedialog.cpp
  30. +0 −3 src/qt/askpassphrasedialog.h
  31. +2 −2 src/qt/clientmodel.cpp
  32. +7 −28 src/qt/coincontroldialog.cpp
  33. +0 −1 src/qt/coincontroldialog.h
  34. +0 −91 src/qt/darksendconfig.cpp
  35. +0 −37 src/qt/darksendconfig.h
  36. +0 −18 src/qt/forms/askpassphrasedialog.ui
  37. +17 −13 src/qt/forms/coincontroldialog.ui
  38. +0 −188 src/qt/forms/darksendconfig.ui
  39. +0 −99 src/qt/forms/optionsdialog.ui
  40. +0 −268 src/qt/forms/overviewpage.ui
  41. +1 −69 src/qt/forms/sendcoinsdialog.ui
  42. +2 −2 src/qt/masternodelist.cpp
  43. +0 −7 src/qt/optionsdialog.cpp
  44. +0 −72 src/qt/optionsmodel.cpp
  45. +0 −9 src/qt/optionsmodel.h
  46. +0 −384 src/qt/overviewpage.cpp
  47. +0 −9 src/qt/overviewpage.h
  48. +13 −260 src/qt/res/css/default.css
  49. BIN src/qt/res/images/checked_radio.png
  50. BIN src/qt/res/images/unchecked_radio.png
  51. +7 −55 src/qt/sendcoinsdialog.cpp
  52. +0 −2 src/qt/sendcoinsdialog.h
  53. +4 −2 src/qt/sin.qrc
  54. +0 −22 src/qt/singui.cpp
  55. +0 −36 src/qt/utilitydialog.cpp
  56. +15 −35 src/qt/walletmodel.cpp
  57. +3 −13 src/qt/walletmodel.h
  58. +2 −4 src/qt/walletview.cpp
  59. +3 −101 src/rpc/masternode.cpp
  60. +1 −1 src/rpc/mining.cpp
  61. +15 −12 src/validation.cpp
  62. +1 −1 src/validation.h
  63. +0 −1 src/wallet/coincontrol.cpp
  64. +0 −1 src/wallet/coincontrol.h
  65. +6 −43 src/wallet/crypter.cpp
  66. +5 −10 src/wallet/crypter.h
  67. +4 −9 src/wallet/rpcwallet.cpp
  68. +8 −878 src/wallet/wallet.cpp
  69. +3 −34 src/wallet/wallet.h
@@ -231,10 +231,6 @@ BITCOIN_CORE_H += \
masternodeconfig.h \
messagesigner.h \
netfulfilledman.h \
privatesend.h \
privatesend-client.h \
privatesend-server.h \
privatesend-util.h \
spork.h \
sporkdb.h

@@ -313,8 +309,6 @@ libsin_server_a_SOURCES += \
masternodeconfig.cpp \
messagesigner.cpp \
netfulfilledman.cpp \
privatesend.cpp \
privatesend-server.cpp \
rpc/governance.cpp \
rpc/masternode.cpp \
spork.cpp \
@@ -354,9 +348,7 @@ libsin_wallet_a_SOURCES = \

# dash wallet
libsin_wallet_a_SOURCES += \
keepass.cpp \
privatesend-client.cpp \
privatesend-util.cpp
keepass.cpp

# crypto primitives library
crypto_libsin_crypto_base_a_CPPFLAGS = $(AM_CPPFLAGS)
@@ -116,8 +116,7 @@ QT_FORMS_UI = \

# Dash
QT_FORMS_UI += \
qt/forms/masternodelist.ui \
qt/forms/darksendconfig.ui
qt/forms/masternodelist.ui
#

QT_MOC_CPP = \
@@ -171,8 +170,7 @@ QT_MOC_CPP = \

# Dash
QT_MOC_CPP += \
qt/moc_masternodelist.cpp \
qt/moc_darksendconfig.cpp
qt/moc_masternodelist.cpp
#

BITCOIN_MM = \
@@ -254,8 +252,7 @@ BITCOIN_QT_H = \

# Dash
BITCOIN_QT_H += \
qt/masternodelist.h \
qt/darksendconfig.h
qt/masternodelist.h
#

RES_ICONS = \
@@ -379,8 +376,7 @@ BITCOIN_QT_WALLET_CPP = \

# Dash
BITCOIN_QT_WALLET_CPP += \
qt/masternodelist.cpp \
qt/darksendconfig.cpp
qt/masternodelist.cpp
#

BITCOIN_QT_CPP = $(BITCOIN_QT_BASE_CPP)
@@ -197,7 +197,8 @@ class CMainParams : public CChainParams {
nMaxReorganizationDepth = 55; // 55 at 2 minute block timespan is +/- 120 minutes/2h.
nMinReorganizationPeers = 3;

consensus.lwmaStartHeight = 260000;

consensus.lwmaStartHeight = 262000;
consensus.lwmaAveragingWindow = 96; }
};

@@ -280,8 +281,8 @@ class CTestNetParams : public CChainParams {
vFixedSeeds.clear();
vSeeds.clear();

vSeeds.emplace_back("206.189.57.75");
vSeeds.emplace_back("165.22.81.15");
//vSeeds.emplace_back("206.189.57.75");
//vSeeds.emplace_back("165.22.81.15");
nDefaultPort = 20980;

base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,63);
@@ -311,7 +312,8 @@ class CTestNetParams : public CChainParams {
nMaxReorganizationDepth = 5; // 5 at 2 minute block timespan is +/- 10 minutes.
nMinReorganizationPeers = 3;

consensus.lwmaStartHeight = 260000;
consensus.lwmaStartHeight = 150;
consensus.lwmaAveragingWindow = 96;
}
};

@@ -426,6 +428,7 @@ class CFinalNetParams : public CChainParams {
nMinReorganizationPeers = 3;

consensus.lwmaStartHeight = 260000;
consensus.lwmaAveragingWindow = 96;
}
};

@@ -507,6 +510,7 @@ class CRegTestParams : public CChainParams {
nMinReorganizationPeers = 3;

consensus.lwmaStartHeight = 260000;
consensus.lwmaAveragingWindow = 96;
}
};

@@ -12,10 +12,6 @@
#include <infinitynodeman.h>
#include <masternode-payments.h>
#include <masternode-sync.h>
#include <privatesend.h>
#ifdef ENABLE_WALLET
#include <privatesend-client.h>
#endif // ENABLE_WALLET

void CDSNotificationInterface::InitializeCurrentBlockTip()
{
@@ -40,19 +36,11 @@ void CDSNotificationInterface::UpdatedBlockTip(const CBlockIndex *pindexNew, con

masternodeSync.UpdatedBlockTip(pindexNew, fInitialDownload, connman);

// FXTC TODO:
// Update global DIP0001 activation status
//fDIP0001ActiveAtTip = (VersionBitsState(pindexNew, Params().GetConsensus(), Consensus::DEPLOYMENT_DIP0001, versionbitscache) == ThresholdState::ACTIVE);

if (fInitialDownload)
return;

mnodeman.UpdatedBlockTip(pindexNew);
infnodeman.UpdatedBlockTip(pindexNew);
CPrivateSend::UpdatedBlockTip(pindexNew);
#ifdef ENABLE_WALLET
privateSendClient.UpdatedBlockTip(pindexNew);
#endif // ENABLE_WALLET
instantsend.UpdatedBlockTip(pindexNew);
mnpayments.UpdatedBlockTip(pindexNew, connman);
governance.UpdatedBlockTip(pindexNew, connman);
@@ -61,5 +49,4 @@ void CDSNotificationInterface::UpdatedBlockTip(const CBlockIndex *pindexNew, con
void CDSNotificationInterface::SyncTransaction(const CTransaction &tx, const CBlockIndex *pindex, int posInBlock)
{
instantsend.SyncTransaction(tx, pindex, posInBlock);
CPrivateSend::SyncTransaction(tx, pindex, posInBlock);
}
@@ -9,6 +9,7 @@
#include <script/standard.h>

#include <shutdown.h>
#include <timedata.h>

#include <util.h>
#ifdef ENABLE_WALLET
@@ -66,7 +66,6 @@ void CInfinitynodeMan::UpdatedBlockTip(const CBlockIndex *pindex)

void CInfinitynodeMan::CheckAndRemove(CConnman& connman)
{
/*this function is called in PrivateSend thread and after sync of node*/
LOCK(cs);
if (nCachedBlockHeight > nLastScanHeight)
{
@@ -68,13 +68,12 @@
#include <masternodeconfig.h>
#include <messagesigner.h>
#include <netfulfilledman.h>
#ifdef ENABLE_WALLET
#include <privatesend-client.h>
#endif // ENABLE_WALLET
#include <privatesend-server.h>

#include <spork.h>
#include <sporkdb.h>

//sinovate
#include <infinitynodeman.h>
//

#ifndef WIN32
#include <signal.h>
@@ -1281,6 +1280,64 @@ bool AppInitLockDataDirectory()
return true;
}

//TODO: Rename/move to core
void ThreadCheckInfinityNode(CConnman& connman)
{
if(fLiteMode) return; // disable all Dash specific functionality

static bool fOneThread;
if(fOneThread) return;
fOneThread = true;

RenameThread("sinovate-ps");

unsigned int nTick = 0;

while (true)
{
MilliSleep(1000);

// try to sync from all available nodes, one step at a time
masternodeSync.ProcessTick(connman);
if(masternodeSync.IsBlockchainSynced() && !ShutdownRequested() && masternodeSync.IsSynced()) {

nTick++;

// make sure to check all masternodes first
mnodeman.Check();

/*SIN TODO*/
//mnodeman.ProcessPendingMnbRequests(connman);
//mnodeman.ProcessPendingMnvRequests(connman);

// check if we should activate or ping every few minutes,
// slightly postpone first run to give net thread a chance to connect to some peers
if(nTick % MASTERNODE_MIN_MNP_SECONDS == 15)
activeMasternode.ManageState(connman);
if(nTick % 60 == 0) {
netfulfilledman.CheckAndRemove();
mnodeman.ProcessMasternodeConnections(connman);
mnodeman.CheckAndRemove(connman);
mnodeman.CheckAndRemoveBurnFundNotUniqueNode(connman);
mnodeman.CheckAndRemoveLimitNumberNode(connman, 1, Params().GetConsensus().nLimitSINNODE_1);
mnodeman.CheckAndRemoveLimitNumberNode(connman, 5, Params().GetConsensus().nLimitSINNODE_5);
mnodeman.CheckAndRemoveLimitNumberNode(connman, 10, Params().GetConsensus().nLimitSINNODE_10);
//mnodeman.WarnMasternodeDaemonUpdates();
mnpayments.CheckAndRemove();
instantsend.CheckAndRemove();
infnodeman.CheckAndRemove(connman);
}
if(fMasterNode && (nTick % (60 * 5) == 0)) {
mnodeman.DoFullVerificationStep(connman);
}
if(nTick % (60 * 5) == 0) {
governance.DoMaintenance(connman);
}
}
}
}


bool AppInitMain()
{
const CChainParams& chainparams = Params();
@@ -1788,7 +1845,7 @@ bool AppInitMain()
}

// Dash
// ********************************************************* Step 11a: setup PrivateSend
// ********************************************************* Step 11a: setup InfinityNode
fMasterNode = gArgs.GetBoolArg("-masternode", false);
// TODO: masternode should have no wallet

@@ -1839,17 +1896,6 @@ bool AppInitMain()
}
}
}

privateSendClient.nLiquidityProvider = std::min(std::max((int)gArgs.GetArg("-liquidityprovider", DEFAULT_PRIVATESEND_LIQUIDITY), 0), 100);
if(privateSendClient.nLiquidityProvider) {
// special case for liquidity providers only, normal clients should use default value
privateSendClient.SetMinBlocksToWait(privateSendClient.nLiquidityProvider * 15);
}

privateSendClient.fEnablePrivateSend = gArgs.GetBoolArg("-enableprivatesend", false);
privateSendClient.fPrivateSendMultiSession = gArgs.GetBoolArg("-privatesendmultisession", DEFAULT_PRIVATESEND_MULTISESSION);
privateSendClient.nPrivateSendRounds = std::min(std::max((int)gArgs.GetArg("-privatesendrounds", DEFAULT_PRIVATESEND_ROUNDS), 2), privateSendClient.nLiquidityProvider ? 99999 : 16);
privateSendClient.nPrivateSendAmount = std::min(std::max((int)gArgs.GetArg("-privatesendamount", DEFAULT_PRIVATESEND_AMOUNT), 2), 999999);
#endif // ENABLE_WALLET

fEnableInstantSend = gArgs.GetBoolArg("-enableinstantsend", 1);
@@ -1864,13 +1910,6 @@ bool AppInitMain()

LogPrintf("fLiteMode %d\n", fLiteMode);
LogPrintf("nInstantSendDepth %d\n", nInstantSendDepth);
#ifdef ENABLE_WALLET
LogPrintf("PrivateSend rounds %d\n", privateSendClient.nPrivateSendRounds);
LogPrintf("PrivateSend amount %d\n", privateSendClient.nPrivateSendAmount);
#endif // ENABLE_WALLET

CPrivateSend::InitStandardDenominations();

// ********************************************************* Step 11b: Load cache data

// LOAD SERIALIZED DAT FILES INTO DATA CACHES FOR INTERNAL USE
@@ -1920,16 +1959,9 @@ bool AppInitMain()

// ********************************************************* Step 11d: start dash-ps-<smth> threads

threadGroup.create_thread(boost::bind(&ThreadCheckPrivateSend, boost::ref(*g_connman)));
if (fMasterNode)
threadGroup.create_thread(boost::bind(&ThreadCheckPrivateSendServer, boost::ref(*g_connman)));
#ifdef ENABLE_WALLET
else
threadGroup.create_thread(boost::bind(&ThreadCheckPrivateSendClient, boost::ref(*g_connman)));
#endif // ENABLE_WALLET
//
threadGroup.create_thread(boost::bind(&ThreadCheckInfinityNode, boost::ref(*g_connman)));

// ********************************************************* Step 12: start node
// ********************************************************* Step 12: start node

int chain_active_height;

@@ -68,19 +68,27 @@ void CInstantSend::ProcessMessage(CNode* pfrom, const std::string& strCommand, C
// Ignore any InstantSend messages until masternode list is synced
if(!masternodeSync.IsMasternodeListSynced()) return;

LOCK(cs_main);
TRY_LOCK(cs_main, lockMain);
if(!lockMain) return;
#ifdef ENABLE_WALLET
std::vector<std::shared_ptr<CWallet>> wallets = GetWallets();
CWallet * const pwallet = (wallets.size() > 0) ? wallets[0].get() : nullptr;
if (pwallet)
LOCK(pwallet->cs_wallet);
if (pwallet) {
TRY_LOCK(pwallet->cs_wallet, lockWallet);
if(!lockWallet) {
return;
}
} else {
return;
}
#endif
LOCK(cs_instantsend);
TRY_LOCK(cs_instantsend, lockInstantsend);
if(!lockInstantsend) return;

if(mapTxLockVotes.count(nVoteHash)) return;
mapTxLockVotes.insert(std::make_pair(nVoteHash, vote));

ProcessTxLockVote(pfrom, vote, connman);
ProcessTxLockVote(pfrom, vote, connman, pwallet);

return;
}
@@ -300,15 +308,19 @@ void CInstantSend::Vote(CTxLockCandidate& txLockCandidate, CConnman& connman)
}

//received a consensus vote
bool CInstantSend::ProcessTxLockVote(CNode* pfrom, CTxLockVote& vote, CConnman& connman)
bool CInstantSend::ProcessTxLockVote(CNode* pfrom, CTxLockVote& vote, CConnman& connman, CWallet* pwallet)
{
// cs_main, cs_wallet and cs_instantsend should be already locked
// cs_main, cs_wallet and cs_instantsend should be already locked, but cs_wallet will only be locked if pwallet != nullptr
AssertLockHeld(cs_main);
#ifdef ENABLE_WALLET
std::vector<std::shared_ptr<CWallet>> wallets = GetWallets();
CWallet * const pwallet = (wallets.size() > 0) ? wallets[0].get() : nullptr;
if (pwallet)
// Make sure we let locks fail and only check for them if they're actually held
TRY_LOCK(pwallet->cs_wallet, lockWallet);
if(!lockWallet) {
return false;
}
if (pwallet) {
AssertLockHeld(pwallet->cs_wallet);
}
#endif
AssertLockHeld(cs_instantsend);

@@ -445,7 +457,7 @@ void CInstantSend::ProcessOrphanTxLockVotes(CConnman& connman)

std::map<uint256, CTxLockVote>::iterator it = mapTxLockVotesOrphan.begin();
while(it != mapTxLockVotesOrphan.end()) {
if(ProcessTxLockVote(NULL, it->second, connman)) {
if(ProcessTxLockVote(NULL, it->second, connman, pwallet)) {
mapTxLockVotesOrphan.erase(it++);
} else {
++it;

0 comments on commit 5778c65

Please sign in to comment.
You can’t perform that action at this time.