Skip to content

Commit 4c675ad

Browse files
committed
Merge pull request #5 from Infernoman/CM
CMasternodeMan - masternode manager class
2 parents 954ba73 + dd10b3e commit 4c675ad

28 files changed

Lines changed: 1516 additions & 766 deletions

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
sudo: false
22
os:
33
- linux
4+
cache:
5+
apt: true
6+
directories:
7+
- $HOME/Transfercoin/src/leveldb
8+
- $HOME/Transfercoin/src/secp256k1
9+
- $HOME/secp256k1
410
addons:
511
apt:
612
sources:

CHANGELOG

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,68 @@ https://github.com/dashpay/dash/commit/b861e7ac4ca871626e75953ed833f9195b762932
4040
Fix priority calculation in CreateTransaction
4141
https://github.com/dashpay/dash/commit/9cd1dd9f6b5aace6c0e780bf4365fb2900757c1a
4242

43+
HasCollateralInputs should check only for at least 1 collateral (not 2)
44+
https://github.com/dashpay/dash/commit/74551e9f31f10e351de1ec07f60513662ccdb06a
45+
46+
CMasternodeman
47+
https://github.com/dashpay/dash/commits/v0.11.2.x?page=12
48+
49+
move list logic back to rpcdarkcsend
50+
https://github.com/dashpay/dash/commit/dd610900516b615c4f1ed9d3cd279485683c4d52
51+
52+
add masternodelist to command list
53+
https://github.com/dashpay/dash/commit/0cd0e9de6d65c66b5f0df566acc7f9cc1f5edb94
54+
55+
track lastTimeChanged for mnodeman
56+
https://github.com/dashpay/dash/commit/003a1b7d72cbf753b7394c473d88a6be0df5a643
57+
58+
show active/total MNs on info tab / update it in separate timer
59+
https://github.com/dashpay/dash/commit/d2e3d67a1d632912e83684e2a8b8e5780eae4216
60+
61+
better naming/readability (Find)
62+
https://github.com/dashpay/dash/commit/0d51e1c90df98f649ea3062efa448c1c5bb9827b
63+
64+
Added dstx support for free transactions ( NEEDS FIXED - AcceptToMemoryPool)
65+
https://github.com/dashpay/dash/commit/13246598b8b84af2ade8b3d0368655fc64f5cca0
66+
67+
68+
69+
Change the way changes are handled:
70+
https://github.com/dashpay/dash/commit/2e05bf212eaf5e0fe98161f673483dc62e5c0a95
71+
72+
rpc fixes:
73+
https://github.com/dashpay/dash/commit/558585039696096b355a9e75beb70b36a3b7cec9
74+
75+
rpc: allow "darksend" only with ENABLE_WALLET
76+
https://github.com/dashpay/dash/commit/0d82275d05e9fb81d8d550a58c3d6202bdfce4e5
77+
78+
fix DoAutomaticDenominating:
79+
https://github.com/dashpay/dash/commit/56471f83304cff936f2ad09242f9a2462389e75b
80+
81+
allow searching masternode list by ip address
82+
https://github.com/dashpay/dash/commit/736e6da6b852119332b41b4da955af4d1b4ed8f9
83+
84+
Few fixes for processing extra messages:
85+
https://github.com/dashpay/dash/commit/1ded1b9ec2de5687b38ac9178cc4b58375201e03
86+
87+
Fix crashes on remove from vector
88+
https://github.com/dashpay/dash/commit/4fe845bf1530ad1b59dcfddebe50f323e1977402
89+
90+
Fix versions:
91+
https://github.com/dashpay/dash/commit/0747da6b36a51f24efa7ca7fcb4f2ffa3332a118
92+
93+
check and remove expired masternodes on client start
94+
https://github.com/dashpay/dash/commit/4af7c7411ac6837260ff5ff04ee4a4a944ac2082
95+
96+
clear maps in mnodeman
97+
https://github.com/dashpay/dash/commit/80ce3f5a061e069145db81850e1afcffa52c7e12
98+
99+
Cleanup copiler
100+
101+
102+
103+
104+
43105

44106

45107
Removal of old code:

src/activemasternode.cpp

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#include "protocol.h"
66
#include "activemasternode.h"
7+
#include "masternodeman.h"
78
#include <boost/lexical_cast.hpp>
89
#include "clientversion.h"
910

@@ -193,16 +194,11 @@ bool CActiveMasternode::Dseep(CTxIn vin, CService service, CKey keyMasternode, C
193194
}
194195

195196
// Update Last Seen timestamp in masternode list
196-
bool found = false;
197-
BOOST_FOREACH(CMasterNode& mn, vecMasternodes) {
198-
//LogPrintf(" -- %s\n", mn.vin.ToString().c_str());
199-
if(mn.vin == vin) {
200-
found = true;
201-
mn.UpdateLastSeen();
202-
}
203-
}
204-
205-
if(!found){
197+
CMasternode* pmn = mnodeman.Find(vin);
198+
if(pmn != NULL)
199+
{
200+
pmn->UpdateLastSeen();
201+
} else {
206202
// Seems like we are trying to send a ping while the masternode is not registered in the network
207203
retErrorMessage = "Darksend Masternode List doesn't include our masternode, Shutting down masternode pinging service! " + vin.ToString();
208204
LogPrintf("CActiveMasternode::Dseep() - Error: %s\n", retErrorMessage.c_str());
@@ -283,17 +279,14 @@ bool CActiveMasternode::Register(CTxIn vin, CService service, CKey keyCollateral
283279
return false;
284280
}
285281

286-
bool found = false;
287282
LOCK(cs_masternodes);
288-
BOOST_FOREACH(CMasterNode& mn, vecMasternodes)
289-
if(mn.vin == vin)
290-
found = true;
291-
292-
if(!found) {
283+
CMasternode* mn = mnodeman.Find(vin);
284+
if(!mn)
285+
{
293286
LogPrintf("CActiveMasternode::Register() - Adding to masternode list service: %s - vin: %s\n", service.ToString().c_str(), vin.ToString().c_str());
294-
CMasterNode mn(service, vin, pubKeyCollateralAddress, vchMasterNodeSignature, masterNodeSignatureTime, pubKeyMasternode, PROTOCOL_VERSION);
287+
CMasternode mn(service, vin, pubKeyCollateralAddress, vchMasterNodeSignature, masterNodeSignatureTime, pubKeyMasternode, PROTOCOL_VERSION);
295288
mn.UpdateLastSeen(masterNodeSignatureTime);
296-
vecMasternodes.push_back(mn);
289+
mnodeman.Add(mn);
297290
}
298291

299292
//send to all peers

0 commit comments

Comments
 (0)