master node decentralization

This commit is contained in:
Evan 2014-03-20 12:17:37 -07:00
parent 6e0917bb47
commit a6e0a10ce4
6 changed files with 18 additions and 8 deletions

View File

@ -1093,8 +1093,8 @@ bool AppInit2(boost::thread_group& threadGroup)
// ********************************************************* Step 10: setup DarkSend
fMaster = GetBoolArg("-master");
if(fMaster) {printf("IS DARKSEND MASTER\n");}
fPaymentNode = GetBoolArg("-paymentnode");
if(fPaymentNode) {printf("IS DARKSEND PAYMENT NODE\n");}
threadGroup.create_thread(boost::bind(&ThreadCheckDarkSendPool));

View File

@ -5239,6 +5239,8 @@ public:
void CDarkSendPool::SetNull(){
printf("CDarkSendPool::SetNull()\n");
IsMaster = false;
vin.clear();
vout.clear();
voutEnc.clear();
@ -5428,7 +5430,7 @@ void CDarkSendPool::Check()
}
printf("CDarkSendPool::Check() -- compiled all signatures:\n%s", txNew.ToString().c_str());
if (fMaster) { //only the main node is master atm
if (IsMaster) { //only the main node is master atm
int i = 0;
BOOST_FOREACH(const CTxIn& txin, txNew.vin)
{
@ -5487,7 +5489,7 @@ void CDarkSendPool::Check()
}
void CDarkSendPool::ChargeFees(){
if(fMaster) {
if(fPaymentNode) {
bool charged = false;
// who didn't provide outputs?
for(unsigned int i = 0; i < vin.size(); i++){
@ -5850,6 +5852,11 @@ void CDarkSendPool::SendMoney(const CTransaction& txCollateral, const CTxIn& fro
printf("CDarkSendPool::SendMoney() -- NEW INPUT -- adding %s\n", from.ToString().c_str());
}
if(IsNull()){
printf("CDarkSendPool::SendMoney() -- SELECTED AS MASTER\n");
IsMaster = true;
}
//vDST.theirAddress.nValue = from_nValue-nFeeRet; //assign full input to output
reservekey = &newReserveKey;

View File

@ -2414,11 +2414,14 @@ public:
unsigned int state;
CScript collateralPubKey;
bool IsMaster;
CDarkSendPool()
{
printf("CDarkSendPool::INIT()\n");
next_session_id = 999;
IsMaster = false;
/* DarkSend uses collateral addresses to trust parties entering the pool
to behave themselves. If they don't it takes their money. */

View File

@ -187,7 +187,7 @@ Value resetpool(const Array& params, bool fHelp)
Object obj;
if (fMaster) {
if (IsMaster) {
obj.push_back(Pair("success", darkSendPool.ForceReset()));
RelayTxPoolForceReset();
} else {

View File

@ -70,7 +70,7 @@ using namespace std;
map<string, string> mapArgs;
map<string, vector<string> > mapMultiArgs;
bool fMaster = false;
bool fPaymentNode = false;
bool fDebug = false;
bool fDebugNet = false;
bool fPrintToConsole = false;

View File

@ -129,7 +129,7 @@ inline void MilliSleep(int64 n)
extern std::map<std::string, std::string> mapArgs;
extern std::map<std::string, std::vector<std::string> > mapMultiArgs;
extern bool fMaster;
extern bool fPaymentNode;
extern bool fDebug;
extern bool fDebugNet;
extern bool fPrintToConsole;