mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Merge branch 'master' of https://github.com/darkcoin/darkcoin
This commit is contained in:
commit
e633bc437b
@ -5,8 +5,7 @@ Please be consistent with the existing coding style.
|
|||||||
|
|
||||||
Block style:
|
Block style:
|
||||||
|
|
||||||
bool Function(char* psz, int n)
|
bool Function(char* psz, int n) {
|
||||||
{
|
|
||||||
// Comment summarising what this section of code does
|
// Comment summarising what this section of code does
|
||||||
for (int i = 0; i < n; i++)
|
for (int i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
@ -65,9 +64,11 @@ Threads
|
|||||||
|
|
||||||
- StartNode : Starts other threads.
|
- StartNode : Starts other threads.
|
||||||
|
|
||||||
|
- ThreadCheckDarkSendPool : Builds and update Masternode list, starts auto-denomination
|
||||||
|
|
||||||
- ThreadGetMyExternalIP : Determines outside-the-firewall IP address, sends addr message to connected peers when it determines it.
|
- ThreadGetMyExternalIP : Determines outside-the-firewall IP address, sends addr message to connected peers when it determines it.
|
||||||
|
|
||||||
- ThreadSocketHandler : Sends/Receives data from peers on port 8333.
|
- ThreadSocketHandler : Sends/Receives data from peers on port 9999.
|
||||||
|
|
||||||
- ThreadMessageHandler : Higher-level message handling (sending and receiving).
|
- ThreadMessageHandler : Higher-level message handling (sending and receiving).
|
||||||
|
|
||||||
@ -83,9 +84,9 @@ Threads
|
|||||||
|
|
||||||
- ThreadFlushWalletDB : Close the wallet.dat file if it hasn't been used in 500ms.
|
- ThreadFlushWalletDB : Close the wallet.dat file if it hasn't been used in 500ms.
|
||||||
|
|
||||||
- ThreadRPCServer : Remote procedure call handler, listens on port 8332 for connections and services them.
|
- ThreadRPCServer : Remote procedure call handler, listens on port 9998 for connections and services them.
|
||||||
|
|
||||||
- ThreadBitcoinMiner : Generates bitcoins
|
- DarkcoinMiner : Generates darkcoins
|
||||||
|
|
||||||
- ThreadMapPort : Universal plug-and-play startup/shutdown
|
- ThreadMapPort : Universal plug-and-play startup/shutdown
|
||||||
|
|
||||||
|
@ -296,10 +296,12 @@ bool CActiveMasternode::GetMasterNodeVin(CTxIn& vin, CPubKey& pubkey, CKey& secr
|
|||||||
if(!strTxHash.empty()) {
|
if(!strTxHash.empty()) {
|
||||||
// Let's find it
|
// Let's find it
|
||||||
uint256 txHash(strTxHash);
|
uint256 txHash(strTxHash);
|
||||||
int outputIndex = boost::lexical_cast<int>(outputIndex);
|
int outputIndex = 0;
|
||||||
|
outputIndex = boost::lexical_cast<int>(outputIndex);
|
||||||
bool found = false;
|
bool found = false;
|
||||||
BOOST_FOREACH(COutput& out, possibleCoins) {
|
BOOST_FOREACH(COutput& out, possibleCoins) {
|
||||||
if(true) {
|
if(out.tx->GetHash() == txHash && out.i == outputIndex)
|
||||||
|
{
|
||||||
selectedOutput = &out;
|
selectedOutput = &out;
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
|
12
src/base58.h
12
src/base58.h
@ -272,10 +272,10 @@ class CBitcoinAddress : public CBase58Data
|
|||||||
public:
|
public:
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PUBKEY_ADDRESS = 48+28, // DarkCoin addresses start with X
|
PUBKEY_ADDRESS = 76, // Darkcoin addresses start with 'X'
|
||||||
SCRIPT_ADDRESS = 5,
|
SCRIPT_ADDRESS = 16, // Darkcoin script addresses start with '7'
|
||||||
PUBKEY_ADDRESS_TEST = 111,
|
PUBKEY_ADDRESS_TEST = 139, // Testnet darkcoin addresses start with 'x' or 'y'
|
||||||
SCRIPT_ADDRESS_TEST = 196,
|
SCRIPT_ADDRESS_TEST = 19, // Testnet darkcoin script addresses start with '8' or '9'
|
||||||
};
|
};
|
||||||
|
|
||||||
bool Set(const CKeyID &id) {
|
bool Set(const CKeyID &id) {
|
||||||
@ -400,8 +400,8 @@ class CBitcoinSecret : public CBase58Data
|
|||||||
public:
|
public:
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PRIVKEY_ADDRESS = CBitcoinAddress::PUBKEY_ADDRESS + 128,
|
PRIVKEY_ADDRESS = 204, // Darkcoin private keys start with '7' or 'X'
|
||||||
PRIVKEY_ADDRESS_TEST = CBitcoinAddress::PUBKEY_ADDRESS_TEST + 128,
|
PRIVKEY_ADDRESS_TEST = 239, // Testnet private keys start with '9' or 'c' (Bitcoin defaults)
|
||||||
};
|
};
|
||||||
|
|
||||||
void SetKey(const CKey& vchSecret)
|
void SetKey(const CKey& vchSecret)
|
||||||
|
@ -1180,6 +1180,7 @@ Array RPCConvertValues(const std::string &strMethod, const std::vector<std::stri
|
|||||||
if (strMethod == "listtransactions" && n > 2) ConvertTo<boost::int64_t>(params[2]);
|
if (strMethod == "listtransactions" && n > 2) ConvertTo<boost::int64_t>(params[2]);
|
||||||
if (strMethod == "listaccounts" && n > 0) ConvertTo<boost::int64_t>(params[0]);
|
if (strMethod == "listaccounts" && n > 0) ConvertTo<boost::int64_t>(params[0]);
|
||||||
if (strMethod == "walletpassphrase" && n > 1) ConvertTo<boost::int64_t>(params[1]);
|
if (strMethod == "walletpassphrase" && n > 1) ConvertTo<boost::int64_t>(params[1]);
|
||||||
|
if (strMethod == "walletpassphrase" && n > 2) ConvertTo<bool>(params[2]);
|
||||||
if (strMethod == "getblocktemplate" && n > 0) ConvertTo<Object>(params[0]);
|
if (strMethod == "getblocktemplate" && n > 0) ConvertTo<Object>(params[0]);
|
||||||
if (strMethod == "listsinceblock" && n > 1) ConvertTo<boost::int64_t>(params[1]);
|
if (strMethod == "listsinceblock" && n > 1) ConvertTo<boost::int64_t>(params[1]);
|
||||||
if (strMethod == "sendmany" && n > 1) ConvertTo<Object>(params[1]);
|
if (strMethod == "sendmany" && n > 1) ConvertTo<Object>(params[1]);
|
||||||
|
28
src/main.cpp
28
src/main.cpp
@ -2813,10 +2813,13 @@ bool CBlock::CheckBlock(CValidationState &state, bool fCheckPOW, bool fCheckMerk
|
|||||||
{
|
{
|
||||||
bool foundPaymentAmount = false;
|
bool foundPaymentAmount = false;
|
||||||
bool foundPayee = false;
|
bool foundPayee = false;
|
||||||
|
bool foundPaymentAndPayee = false;
|
||||||
|
|
||||||
CScript payee;
|
CScript payee;
|
||||||
if(!masternodePayments.GetBlockPayee(pindexBest->nHeight+1, payee) || payee == CScript()){
|
if(!masternodePayments.GetBlockPayee(pindexBest->nHeight+1, payee) || payee == CScript()){
|
||||||
foundPayee = true; //doesn't require a specific payee
|
foundPayee = true; //doesn't require a specific payee
|
||||||
|
foundPaymentAmount = true;
|
||||||
|
foundPaymentAndPayee = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int i = 0; i < vtx[0].vout.size(); i++) {
|
for (unsigned int i = 0; i < vtx[0].vout.size(); i++) {
|
||||||
@ -2824,15 +2827,28 @@ bool CBlock::CheckBlock(CValidationState &state, bool fCheckPOW, bool fCheckMerk
|
|||||||
foundPaymentAmount = true;
|
foundPaymentAmount = true;
|
||||||
if(vtx[0].vout[i].scriptPubKey == payee )
|
if(vtx[0].vout[i].scriptPubKey == payee )
|
||||||
foundPayee = true;
|
foundPayee = true;
|
||||||
|
if(vtx[0].vout[i].nValue == masternodePaymentAmount && vtx[0].vout[i].scriptPubKey == payee)
|
||||||
|
foundPaymentAndPayee = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!foundPaymentAmount || !foundPayee) {
|
if (GetBlockTime() < 1419207339){
|
||||||
CTxDestination address1;
|
if(!foundPaymentAmount || !foundPayee) {
|
||||||
ExtractDestination(payee, address1);
|
CTxDestination address1;
|
||||||
CBitcoinAddress address2(address1);
|
ExtractDestination(payee, address1);
|
||||||
|
CBitcoinAddress address2(address1);
|
||||||
|
|
||||||
LogPrintf("CheckBlock() : Couldn't find masternode payment(%d|%"PRI64u") or payee(%d|%s) nHeight %d. \n", foundPaymentAmount, masternodePaymentAmount, foundPayee, address2.ToString().c_str(), pindexBest->nHeight+1);
|
LogPrintf("CheckBlock() : Couldn't find masternode payment(%d|%"PRI64u") or payee(%d|%s) nHeight %d. \n", foundPaymentAmount, masternodePaymentAmount, foundPayee, address2.ToString().c_str(), pindexBest->nHeight+1);
|
||||||
if(EnforceMasternodePayments) return state.DoS(100, error("CheckBlock() : Couldn't find masternode payment or payee"));
|
if(EnforceMasternodePayments) return state.DoS(100, error("CheckBlock() : Couldn't find masternode payment or payee"));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(!foundPaymentAndPayee) {
|
||||||
|
CTxDestination address1;
|
||||||
|
ExtractDestination(payee, address1);
|
||||||
|
CBitcoinAddress address2(address1);
|
||||||
|
|
||||||
|
LogPrintf("CheckBlock() : Couldn't find masternode payment(%d|%"PRI64u") or payee(%d|%s) nHeight %d. \n", foundPaymentAmount, masternodePaymentAmount, foundPayee, address2.ToString().c_str(), pindexBest->nHeight+1);
|
||||||
|
if(EnforceMasternodePayments) return state.DoS(100, error("CheckBlock() : Couldn't find masternode payment or payee"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -59,7 +59,7 @@ void ProcessMessageMasternode(CNode* pfrom, std::string& strCommand, CDataStream
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isLocal = false; // addr.IsRFC1918();
|
bool isLocal = addr.IsRFC1918();
|
||||||
std::string vchPubKey(pubkey.begin(), pubkey.end());
|
std::string vchPubKey(pubkey.begin(), pubkey.end());
|
||||||
std::string vchPubKey2(pubkey2.begin(), pubkey2.end());
|
std::string vchPubKey2(pubkey2.begin(), pubkey2.end());
|
||||||
|
|
||||||
|
@ -187,14 +187,30 @@ void SendCoinsDialog::on_sendButton_clicked()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
WalletModel::UnlockContext ctx(model->requestUnlock(true));
|
// request unlock only if was locked or unlocked for mixing:
|
||||||
if(!ctx.isValid())
|
// this way we let users unlock by walletpassphrase or by menu
|
||||||
|
// and make many transactions while unlocking through this dialog
|
||||||
|
// will call relock
|
||||||
|
WalletModel::EncryptionStatus encStatus = model->getEncryptionStatus();
|
||||||
|
if(encStatus == model->Locked ||
|
||||||
|
encStatus == model->UnlockedForAnonymizationOnly)
|
||||||
{
|
{
|
||||||
// Unlock wallet was cancelled
|
WalletModel::UnlockContext ctx(model->requestUnlock(true));
|
||||||
fNewRecipientAllowed = true;
|
if(!ctx.isValid())
|
||||||
|
{
|
||||||
|
// Unlock wallet was cancelled
|
||||||
|
fNewRecipientAllowed = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
send(recipients);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// already unlocked or not encrypted at all
|
||||||
|
send(recipients);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SendCoinsDialog::send(QList<SendCoinsRecipient> recipients)
|
||||||
|
{
|
||||||
WalletModel::SendCoinsReturn sendstatus;
|
WalletModel::SendCoinsReturn sendstatus;
|
||||||
if (!model->getOptionsModel() || !model->getOptionsModel()->getCoinControlFeatures())
|
if (!model->getOptionsModel() || !model->getOptionsModel()->getCoinControlFeatures())
|
||||||
sendstatus = model->sendCoins(recipients);
|
sendstatus = model->sendCoins(recipients);
|
||||||
|
@ -50,6 +50,7 @@ private:
|
|||||||
bool fNewRecipientAllowed;
|
bool fNewRecipientAllowed;
|
||||||
bool boolCheckedBalance;
|
bool boolCheckedBalance;
|
||||||
int cachedNumBlocks;
|
int cachedNumBlocks;
|
||||||
|
void send(QList<SendCoinsRecipient> recipients);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_sendButton_clicked();
|
void on_sendButton_clicked();
|
||||||
|
@ -89,9 +89,9 @@ Value masternode(const Array& params, bool fHelp)
|
|||||||
|
|
||||||
if (fHelp ||
|
if (fHelp ||
|
||||||
(strCommand != "start" && strCommand != "start-alias" && strCommand != "start-many" && strCommand != "stop" && strCommand != "stop-alias" && strCommand != "stop-many" && strCommand != "list" && strCommand != "list-conf" && strCommand != "count" && strCommand != "enforce"
|
(strCommand != "start" && strCommand != "start-alias" && strCommand != "start-many" && strCommand != "stop" && strCommand != "stop-alias" && strCommand != "stop-many" && strCommand != "list" && strCommand != "list-conf" && strCommand != "count" && strCommand != "enforce"
|
||||||
&& strCommand != "debug" && strCommand != "current" && strCommand != "winners" && strCommand != "genkey" && strCommand != "connect"))
|
&& strCommand != "debug" && strCommand != "current" && strCommand != "winners" && strCommand != "genkey" && strCommand != "connect" && strCommand != "outputs"))
|
||||||
throw runtime_error(
|
throw runtime_error(
|
||||||
"masternode <start|start-alias|start-many|stop|stop-alias|stop-many|list|list-conf|count|debug|current|winners|genkey|enforce> passphrase\n");
|
"masternode <start|start-alias|start-many|stop|stop-alias|stop-many|list|list-conf|count|debug|current|winners|genkey|enforce|outputs> [passphrase]\n");
|
||||||
|
|
||||||
if (strCommand == "stop")
|
if (strCommand == "stop")
|
||||||
{
|
{
|
||||||
@ -442,6 +442,19 @@ Value masternode(const Array& params, bool fHelp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strCommand == "outputs"){
|
||||||
|
// Find possible candidates
|
||||||
|
vector<COutput> possibleCoins = activeMasternode.SelectCoinsMasternode();
|
||||||
|
|
||||||
|
Object obj;
|
||||||
|
BOOST_FOREACH(COutput& out, possibleCoins) {
|
||||||
|
obj.push_back(Pair(out.tx->GetHash().ToString().c_str(), boost::lexical_cast<std::string>(out.i)));
|
||||||
|
}
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (strCommand == "create")
|
if (strCommand == "create")
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -1354,7 +1354,7 @@ Value walletpassphrase(const Array& params, bool fHelp)
|
|||||||
{
|
{
|
||||||
if (pwalletMain->IsCrypted() && (fHelp || params.size() < 2 || params.size() > 3))
|
if (pwalletMain->IsCrypted() && (fHelp || params.size() < 2 || params.size() > 3))
|
||||||
throw runtime_error(
|
throw runtime_error(
|
||||||
"walletpassphrase <passphrase> <timeout> [anonymizenonly]\n"
|
"walletpassphrase <passphrase> <timeout> [anonymizenonly=false]\n"
|
||||||
"Stores the wallet decryption key in memory for <timeout> seconds.\n"
|
"Stores the wallet decryption key in memory for <timeout> seconds.\n"
|
||||||
"if [anonymizeonly] is true sending functions are disabled.");
|
"if [anonymizeonly] is true sending functions are disabled.");
|
||||||
if (fHelp)
|
if (fHelp)
|
||||||
@ -1388,7 +1388,7 @@ Value walletpassphrase(const Array& params, bool fHelp)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw runtime_error(
|
throw runtime_error(
|
||||||
"walletpassphrase <passphrase> <timeout> [anonymizeonly]\n"
|
"walletpassphrase <passphrase> <timeout> [anonymizeonly=false]\n"
|
||||||
"Stores the wallet decryption key in memory for <timeout> seconds.\n"
|
"Stores the wallet decryption key in memory for <timeout> seconds.\n"
|
||||||
"if [anonymizeonly] is true sending functions are disabled.");
|
"if [anonymizeonly] is true sending functions are disabled.");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user