Skip to content

Commit

Permalink
block splitter bool in wallet.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
presstab committed Nov 18, 2014
1 parent 03987fe commit 6bfe1dd
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 15 deletions.
17 changes: 8 additions & 9 deletions src/qt/sendcoinsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ SendCoinsDialog::SendCoinsDialog(QWidget *parent) :
ui->labelCoinControlChange->addAction(clipboardChangeAction);

fNewRecipientAllowed = true;
fSplitBlock = false;
}

void SendCoinsDialog::setModel(WalletModel *model)
Expand Down Expand Up @@ -130,7 +129,7 @@ void SendCoinsDialog::on_sendButton_clicked()
SendCoinsEntry *entry = qobject_cast<SendCoinsEntry*>(ui->entries->itemAt(i)->widget());
CBitcoinAddress address = entry->getValue().address.toStdString();
if(!model->isMine(address))
fSplitBlock = false; //dont allow the blocks to split if sending to an outside address
model->setSplitBlock(false); //dont allow the blocks to split if sending to an outside address
if(entry)
{
if(entry->validate())
Expand All @@ -153,19 +152,19 @@ void SendCoinsDialog::on_sendButton_clicked()
//set split block
int nSplitBlock = 1;
if (ui->splitBlockCheckBox->checkState() == Qt::Checked)
fSplitBlock = true;
model->setSplitBlock(true);
else
fSplitBlock = false;
model->setSplitBlock(false);
if (ui->entries->count() > 1)
fSplitBlock = false;
if (fSplitBlock)
model->setSplitBlock(false);
if (model->getSplitBlock())
nSplitBlock = int(ui->splitBlockLineEdit->text().toDouble());

// Format confirmation message
QStringList formatted;
foreach(const SendCoinsRecipient &rcp, recipients)
{
if(!fSplitBlock)
if(!model->getSplitBlock())
{
#if QT_VERSION < 0x050000
formatted.append(tr("<b>%1</b> to %2 (%3)").arg(BitcoinUnits::formatWithUnit(BitcoinUnits::BTC, rcp.amount), Qt::escape(rcp.label), rcp.address));
Expand Down Expand Up @@ -498,14 +497,14 @@ void SendCoinsDialog::coinControlSplitBlockChecked(int state)
{
if (state == Qt::Checked)
{
fSplitBlock = true;
model->setSplitBlock(true);
ui->splitBlockLineEdit->setEnabled(true);
ui->labelBlockSizeText->setEnabled(true);
ui->labelBlockSize->setEnabled(true);
}
else
{
fSplitBlock = false;
model->setSplitBlock(false);
ui->splitBlockLineEdit->setEnabled(false);
ui->labelBlockSizeText->setEnabled(false);
ui->labelBlockSize->setEnabled(false);
Expand Down
8 changes: 4 additions & 4 deletions src/qt/walletmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,14 +406,14 @@ QString WalletModel::getBestAddress()
return QString::fromStdString(wallet->strBestAddress);
}

void WalletModel::setCombine(bool fCombine)
void WalletModel::setSplitBlock(bool fSplitBlock)
{
wallet->fCombine = fCombine;
wallet->fSplitBlock = fSplitBlock;
}

bool WalletModel::getCombine()
bool WalletModel::getSplitBlock()
{
return wallet->fCombine;
return wallet->fSplitBlock;
}


Expand Down
4 changes: 2 additions & 2 deletions src/qt/walletmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ class WalletModel : public QObject
qint64 getAmountSelected();
void setBestAddress(std::string strAddress);
QString getBestAddress();
void setCombine(bool fCombine);
bool getCombine();
void setSplitBlock(bool fSplitBlock);
bool getSplitBlock();
//Wallet Information about StakeForCharity
int getStakeForCharityPercent();
QString getStakeForCharityAddress();
Expand Down
7 changes: 7 additions & 0 deletions src/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1304,6 +1304,13 @@ bool CWallet::CreateTransaction(const vector<pair<CScript, int64> >& vecSend, CW
if( nSplitBlock < 1 )
nSplitBlock = 1;
// vouts to the payees

if (!fSplitBlock)
{
BOOST_FOREACH (const PAIRTYPE(CScript, int64)& s, vecSend)
wtxNew.vout.push_back(CTxOut(s.second, s.first));
}
else
BOOST_FOREACH (const PAIRTYPE(CScript, int64)& s, vecSend)
{
uint64 nBlockAmount = 0;
Expand Down
3 changes: 3 additions & 0 deletions src/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class CWallet : public CCryptoKeyStore
std::string strBestAddress;
bool fCombine;
uint64 nStakeSplitThreshold;
bool fSplitBlock;

std::set<int64> setKeyPool;

Expand Down Expand Up @@ -124,6 +125,7 @@ class CWallet : public CCryptoKeyStore
strBestAddress = "";
fCombine = false;
nStakeSplitThreshold = 1000;
fSplitBlock = false;
}
CWallet(std::string strWalletFileIn)
{
Expand All @@ -146,6 +148,7 @@ class CWallet : public CCryptoKeyStore
strBestAddress = "";
fCombine = false;
nStakeSplitThreshold = 1000;
fSplitBlock = false;
}

std::map<uint256, CWalletTx> mapWallet;
Expand Down

0 comments on commit 6bfe1dd

Please sign in to comment.