gui updates when master updates now

This commit is contained in:
Evan 2014-04-02 08:44:16 -07:00
parent 6197dcd139
commit 93131d106e
7 changed files with 62 additions and 8 deletions

View File

@ -3712,6 +3712,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
accepted = 1;
pfrom->PushMessage("dssu", darkSendPool.GetState(), darkSendPool.GetEntriesCount(), accepted);
darkSendPool.Check();
RelayTxPoolStatus(darkSendPool.GetState(), darkSendPool.GetEntriesCount(), -1);
} else {
pfrom->PushMessage("dssu", darkSendPool.GetState(), darkSendPool.GetEntriesCount(), accepted);
}
@ -3726,7 +3728,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
int entriesCount;
int accepted;
vRecv >> state >> entriesCount >> accepted;
darkSend.StatusUpdate(state, entriesCount, accepted);
darkSendPool.StatusUpdate(state, entriesCount, accepted);
printf("DarkSendStatusUpdate - state: %i entriesCount: %i accepted: %i \n", state, entriesCount, accepted);
}
@ -3744,6 +3747,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
if(darkSendPool.AddScriptSig(sig, vin, pubKey)){
darkSendPool.Check();
RelayTxPoolStatus(darkSendPool.GetState(), darkSendPool.GetEntriesCount(), -1);
}
}
@ -5222,7 +5226,6 @@ void CDarkSendPool::SetNull(){
lastTimeChanged = GetTimeMillis();
sigCount = 0;
ResetDarkSendMembers();
}
void CDarkSendPool::SetCollateralAddress(std::string strAddress){
@ -5341,6 +5344,8 @@ void CDarkSendPool::Check()
if(state == POOL_STATUS_TRANSMISSION) {
printf("CDarkSendPool::Check() -- TRANSMIT\n");
SetNull();
RelayTxPoolStatus(darkSendPool.GetState(), darkSendPool.GetEntriesCount(), -1);
ResetDarkSendMembers();
pwalletMain->Lock();
}
@ -5446,6 +5451,8 @@ bool CDarkSendPool::IsCollateralValid(const CTransaction& txCollateral){
}
bool CDarkSendPool::AddEntry(const CTxIn& newInput, const int64& nAmount, const CTransaction& txCollateral, const CTxOut& newOutput, const CTxOut& newOutput2){
if (!fMasterNode) return false;
if (newInput.prevout.IsNull() || nAmount < 0)
return false;
@ -5467,6 +5474,7 @@ bool CDarkSendPool::AddEntry(const CTxIn& newInput, const int64& nAmount, const
entries.push_back(v);
printf("CDarkSendPool::AddEntry -- adding %s\n", newInput.ToString().c_str());
return true;
}
return false;
@ -5541,7 +5549,9 @@ bool CDarkSendPool::StatusUpdate(int newState, int newEntriesCount, int newAccep
state = newState;
entriesCount = newEntriesCount;
lastEntryAccepted = newAccepted;
if(newAccepted != -1)
lastEntryAccepted = newAccepted;
return true;
}

View File

@ -2407,7 +2407,16 @@ public:
int GetEntriesCount() const
{
return entries.size();
if(fMasterNode){
return entries.size();
} else {
return entriesCount;
}
}
int GetLastEntryAccepted() const
{
return lastEntryAccepted;
}
int GetSignatureCount() const
@ -2425,6 +2434,9 @@ public:
printf("CDarkSendPool::UpdateState() == %d | %d \n", state, newState);
if(state != newState){
lastTimeChanged = GetTimeMillis();
if(fMasterNode) {
RelayTxPoolStatus(darkSendPool.GetState(), darkSendPool.GetEntriesCount(), -1);
}
}
state = newState;
}

View File

@ -464,6 +464,7 @@ CNode* ConnectNode(CAddress addrConnect, const char *pszDest, bool darkSendMaste
CNode* pnode = FindNode((CService)addrConnect);
if (pnode)
{
if(darkSendMaster) pnode->fDarkSendMaster = true;
pnode->AddRef();
return pnode;
}
@ -1928,6 +1929,21 @@ void RelayTxPoolIn(const CTxIn& in, const int64& nAmount, const CTransaction& tx
}
}
void RelayTxPoolStatus(const int newState, const int newEntriesCount, const int newAccepted)
{
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes)
{
printf("RelayTxPoolStatus \n");
if(!pnode->fDarkSendMember)
continue;
printf("RelayTxPoolStatus - found member, relaying message \n");
pnode->PushMessage("dssu", newState, newEntriesCount, newAccepted);
}
}
void ResetDarkSendMembers()
{
LOCK(cs_vNodes);

View File

@ -646,9 +646,9 @@ class CTxIn;
class CTxOut;
void RelayTransaction(const CTransaction& tx, const uint256& hash);
void RelayTransaction(const CTransaction& tx, const uint256& hash, const CDataStream& ss);
void RelayTxPoolFinalTransaction(const CTransaction& txNew);
void RelayTxPoolIn(const CTxIn& in, const int64& nAmount, const CTransaction& txCollateral, const CTransaction& txSupporting, const CTxOut& out, const CTxOut& out2);
void RelayTxPoolStatus(const int newState, const int newEntriesCount, const int newAccepted);
void ResetDarkSendMembers();
#endif

View File

@ -14,6 +14,7 @@
#include "coincontroldialog.h"
#include <QMessageBox>
#include <QTimer>
#include <QTextDocument>
#include <QScrollBar>
#include <QClipboard>
@ -47,6 +48,10 @@ SendCoinsDialog::SendCoinsDialog(QWidget *parent) :
connect(ui->pushButtonCoinControl, SIGNAL(clicked()), this, SLOT(coinControlButtonClicked()));
connect(ui->checkBoxCoinControlChange, SIGNAL(stateChanged(int)), this, SLOT(coinControlChangeChecked(int)));
connect(ui->lineEditCoinControlChange, SIGNAL(textEdited(const QString &)), this, SLOT(coinControlChangeEdited(const QString &)));
timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(darkSendStatusButton()));
timer->start(333);
// Coin Control: clipboard actions
QAction *clipboardQuantityAction = new QAction(tr("Copy quantity"), this);
@ -248,10 +253,19 @@ void SendCoinsDialog::darkSendStatusButton()
{
int state = darkSendPool.GetState();
int entries = darkSendPool.GetEntriesCount();
int accepted = 0; //darkSendPool.LastEntryAccepted();
int accepted = darkSendPool.GetLastEntryAccepted();
std::ostringstream convert;
convert << " State " << state << " | Entries " << entries << " | Accepted " << accepted;
if(state == POOL_STATUS_ACCEPTING_ENTRIES)
convert << "darkSend Status => ( Entries " << entries << " | Accepted " << accepted << " )";
else if(state == POOL_STATUS_SIGNING)
convert << "darkSend Status => SIGNING";
else if(state == POOL_STATUS_TRANSMISSION)
convert << "darkSend Status => TRANSMISSION";
else
convert << "darkSend Status => UNKNOWN STATE";
QString s(convert.str().c_str());
ui->darkSendStatusButton->setText(s);

View File

@ -3,6 +3,7 @@
#include <QDialog>
#include <QString>
#include <QTimer>
namespace Ui {
class SendCoinsDialog;
@ -45,6 +46,7 @@ public slots:
void setState(int state, int entries, int accepted);
private:
QTimer *timer;
Ui::SendCoinsDialog *ui;
WalletModel *model;
bool fNewRecipientAllowed;

View File

@ -1627,7 +1627,7 @@ string CWallet::DarkSendMoney(const CTxDestination& address, int64 nValue)
std::string CWallet::Denominate(CWalletTx& wtxDenominate)
{
int count = 10;
int count = 1; //amount of inputs to try to make
int successful = 0;
bool done = false;