This commit is contained in:
Evan 2014-03-20 14:10:17 -07:00
parent 28d909e0ed
commit 2b4e8b64db
4 changed files with 28 additions and 22 deletions

View File

@ -3696,7 +3696,9 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
darkSendPool.Check();
}
else if (strCommand == "dsf") { //DarkSend Final tx
else if (strCommand == "dsf") { //DarkSend Final tx
printf("got RelayTxPoolFinalTransaction\n");
if (pfrom->nVersion != darkSendPool.MIN_PEER_PROTO_VERSION) {
return false;
}
@ -3707,12 +3709,14 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
vRecv >> session_id >> txNew;
if(session_id != darkSendPool.GetSessionID()){
printf("CDarkSendPool()::%s - stale session \n", strCommand);
printf("CDarkSendPool()::%s - stale session \n", strCommand.c_str());
return false;
}
//check to see if input is spent already? (and probably not confirmed)
printf("got AddFinalTransaction\n");
if(darkSendPool.AddFinalTransaction(txNew)){
printf("good\n");
RelayTxPoolFinalTransaction(session_id, txNew);
}
}
@ -3729,7 +3733,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
vRecv >> session_id >> in >> nAmount >> txCollateral;
if(session_id != darkSendPool.GetSessionID()){
printf("CDarkSendPool()::%s - stale session \n", strCommand);
printf("CDarkSendPool()::%s - stale session \n", strCommand.c_str());
return false;
}
@ -3752,7 +3756,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
vRecv >> session_id >> out >> voutEnc >> txCollateral;
if(session_id != darkSendPool.GetSessionID()){
printf("CDarkSendPool()::%s - stale session \n", strCommand);
printf("CDarkSendPool()::%s - stale session \n", strCommand.c_str());
return false;
}
@ -3774,7 +3778,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
vRecv >> session_id >> sig >> vin >> pubKey;
if(session_id != darkSendPool.GetSessionID()){
printf("CDarkSendPool()::%s - stale session \n", strCommand);
printf("CDarkSendPool()::%s - stale session \n", strCommand.c_str());
return false;
}
@ -5117,7 +5121,7 @@ void static DarkCoinMiner(CWallet *pwallet)
}
// Check for stop or if block needs to be rebuilt
boost::this_thread::interruption_point();11
boost::this_thread::interruption_point();
if (vNodes.empty())
break;
if (pblock->nNonce >= 0xffff0000)
@ -5262,7 +5266,8 @@ void CDarkSendPool::SetNull(){
printf("CDarkSendPool::SetNull()\n");
IsMaster = false;
txFinalTransaction = CTransaction();
txFinalTransaction.vin.clear();
txFinalTransaction.vout.clear();
vin.clear();
vout.clear();
@ -5421,19 +5426,17 @@ void CDarkSendPool::Check()
UpdateState(POOL_STATUS_SIGNING);
if (IsMaster) {
CTransaction txNew;
txNew.vin.clear();
txNew.vout.clear();
txFinalTransaction.vin.clear();
txFinalTransaction.vout.clear();
for(unsigned int i = 0; i < vout.size(); i++){
txNew.vout.push_back(vout[i]);
txFinalTransaction.vout.push_back(vout[i]);
}
int mine = -1;
for(unsigned int i = 0; i < vin.size(); i++){
txNew.vin.push_back(vin[i]);
txFinalTransaction.vin.push_back(vin[i]);
}
RelayTxPoolFinalTransaction(txNew);
RelayTxPoolFinalTransaction(session_id, txFinalTransaction);
}
Sign();
@ -5659,7 +5662,7 @@ void CDarkSendPool::Sign(){
RelayTxPoolSig(session_id, txFinalTransaction.vin[n].scriptSig, dst.fromAddress, dst.fromAddress.prevPubKey);
}
if(fDebug) printf("CDarkSendPool::Sign - txNew:\n%s", txNew.ToString().c_str());
if(fDebug) printf("CDarkSendPool::Sign - txNew:\n%s", txFinalTransaction.ToString().c_str());
}
}
@ -5922,11 +5925,17 @@ void CDarkSendPool::SendMoney(const CTransaction& txCollateral, const CTxIn& fro
bool CDarkSendPool::AddFinalTransaction(CTransaction& txNewFinalTransaction){
if(fDebug) printf("CDarkSendPool::AddFinalTransaction - Got Finalized Transaction\n");
if(!txFinalTransaction.vin.empty()){
printf("CDarkSendPool::AddFinalTransaction - Rejected Final Transaction!\n");
return false;
}
txFinalTransaction = txNewFinalTransaction;
if(state == POOL_STATUS_SIGNING) {
Sign();
}
return true; //check validity of sig
}

View File

@ -2417,8 +2417,6 @@ public:
CScript collateralPubKey;
bool IsMaster;
bool IsMaster;
CDarkSendPool()
{
printf("CDarkSendPool::INIT()\n");
@ -2537,8 +2535,7 @@ public:
void SendMoney(const CTransaction& txCollateral, const CTxIn& from, const CTxOut& to, int64& nFeeRet, CKeyStore& newKeys, int64 from_nValue, CScript& pubScript, CReserveKey& reservekey);
void AddQueuedSignatures();
std::string Denominate();
void SelectMasterNode();
bool AddFinalTransaction(CTransaction txNewFinalTransaction);
bool AddFinalTransaction(CTransaction& txNewFinalTransaction);
IMPLEMENT_SERIALIZE
(

View File

@ -1927,9 +1927,9 @@ void RelayGetTxPool()
return;
}
}
void RelayTxPoolFinalTransaction(const CTransaction txNew)
void RelayTxPoolFinalTransaction(const int64 session_id, const CTransaction& txNew)
{
printf("RelayTxPoolFinalTransaction\n");
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes)
{

View File

@ -643,7 +643,7 @@ class CTxOut;
void RelayTransaction(const CTransaction& tx, const uint256& hash);
void RelayTransaction(const CTransaction& tx, const uint256& hash, const CDataStream& ss);
void RelayTxPool(const int64 session_id, const unsigned int state);
void RelayTxPoolFinalTransaction(const CTransaction txNew);
void RelayTxPoolFinalTransaction(const int64 session_id, const CTransaction& txNew);
void RelayGetTxPool();
void RelayTxPoolIn(const int64 session_id, const CTxIn& tx, const int64& nAmount, const CTransaction& txCollateral);
void RelayTxPoolOut(const int64 session_id, const CTxOut& tx, const int64 voutEnc, const CTransaction& txCollateral);