mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 20:42:59 +01:00
missing changes
This commit is contained in:
parent
d7230b7962
commit
4dc232ac4d
@ -1859,6 +1859,23 @@ int CDarkSendPool::GetDenominationsByAmount(int64 nAmount){
|
||||
return GetDenominations(vout1);
|
||||
}
|
||||
|
||||
bool CDarkSendSigner::IsVinAssociatedWithPubkey(CTxIn& vin, CPubKey& pubkey){
|
||||
CScript payee2;
|
||||
payee2.SetDestination(pubkey.GetID());
|
||||
|
||||
CTransaction txVin;
|
||||
uint256 hash;
|
||||
if(GetTransaction(vin.prevout.hash, txVin, hash, true)){
|
||||
BOOST_FOREACH(CTxOut out, txVin.vout){
|
||||
if(out.nValue == 1000*COIN){
|
||||
if(out.scriptPubKey == payee2) return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CDarkSendSigner::SetKey(std::string strSecret, std::string& errorMessage, CKey& key, CPubKey& pubkey){
|
||||
CBitcoinSecret vchSecret;
|
||||
bool fGood = vchSecret.SetString(strSecret);
|
||||
@ -1905,6 +1922,8 @@ bool CDarkSendSigner::VerifyMessage(CPubKey pubkey, vector<unsigned char>& vchSi
|
||||
|
||||
bool CDarksendQueue::Sign()
|
||||
{
|
||||
if(!fMasterNode) return false;
|
||||
|
||||
std::string strMessage = vin.ToString() + boost::lexical_cast<std::string>(nDenom) + boost::lexical_cast<std::string>(time) + boost::lexical_cast<std::string>(ready);
|
||||
|
||||
CKey key2;
|
||||
|
@ -255,6 +255,7 @@ public:
|
||||
class CDarkSendSigner
|
||||
{
|
||||
public:
|
||||
bool IsVinAssociatedWithPubkey(CTxIn& vin, CPubKey& pubkey);
|
||||
bool SetKey(std::string strSecret, std::string& errorMessage, CKey& key, CPubKey& pubkey);
|
||||
bool SignMessage(std::string strMessage, std::string& errorMessage, std::vector<unsigned char>& vchSig, CKey key);
|
||||
bool VerifyMessage(CPubKey pubkey, std::vector<unsigned char>& vchSig, std::string strMessage, std::string& errorMessage);
|
||||
|
10
src/main.cpp
10
src/main.cpp
@ -3940,6 +3940,10 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!fMasterNode){
|
||||
return false;
|
||||
}
|
||||
|
||||
int64 nAmount;
|
||||
CTransaction txCollateral;
|
||||
vRecv >> nAmount >> txCollateral;
|
||||
@ -4343,6 +4347,12 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
||||
}
|
||||
}
|
||||
|
||||
if(!darkSendSigner.IsVinAssociatedWithPubkey(vin, pubkey)) {
|
||||
LogPrintf("dsee - Got mismatched pubkey and vin\n");
|
||||
pfrom->Misbehaving(100);
|
||||
return false;
|
||||
}
|
||||
|
||||
LogPrintf("dsee - Got NEW masternode entry %s\n", addr.ToString().c_str());
|
||||
|
||||
CValidationState state;
|
||||
|
Loading…
Reference in New Issue
Block a user