Skip to content

Commit

Permalink
Merge pull request #249 from BlockMechanic/segwit
Browse files Browse the repository at this point in the history
minor
  • Loading branch information
BlockMechanic authored Dec 25, 2022
2 parents 86fb78a + b6bb54b commit 7d8f35e
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .release
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.0.84
0.0.0.88
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
AC_PREREQ([2.69])
define(_CLIENT_VERSION_MAJOR, 0)
define(_CLIENT_VERSION_MINOR, 21)
define(_CLIENT_VERSION_BUILD, 84)
define(_CLIENT_VERSION_BUILD, 88)
define(_CLIENT_VERSION_RC, )
define(_CLIENT_VERSION_IS_RELEASE, false)
define(_COPYRIGHT_YEAR, 2022)
Expand Down
27 changes: 24 additions & 3 deletions src/qt/sendcoinsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <QScrollBar>
#include <QSettings>
#include <QTextDocument>
#include <QDebug>

static const std::array<int, 9> confTargets = { {2, 4, 6, 12, 24, 48, 144, 504, 1008} };
int getConfTargetForIndex(int index) {
Expand Down Expand Up @@ -239,7 +240,7 @@ SendCoinsDialog::~SendCoinsDialog()

void SendCoinsDialog::checkAndSend(const QList<SendAssetsRecipient> &recipients, QStringList formatted)
{
fNewRecipientAllowed = false;
/* fNewRecipientAllowed = false;
WalletModel::EncryptionStatus encStatus = model->getEncryptionStatus();
if(encStatus == model->Locked) {
WalletModel::UnlockContext ctx(model->requestUnlock());
Expand All @@ -250,7 +251,10 @@ void SendCoinsDialog::checkAndSend(const QList<SendAssetsRecipient> &recipients,
send(recipients, formatted);
return;
}
send(recipients, formatted);
send(recipients, formatted);*/
m_recipients = recipients;
on_sendButton_clicked();
m_recipients.clear();
}

QStringList SendCoinsDialog::constructConfirmationMessage(QList<SendAssetsRecipient>& recipients)
Expand Down Expand Up @@ -284,7 +288,7 @@ QStringList SendCoinsDialog::constructConfirmationMessage(QList<SendAssetsRecipi

bool SendCoinsDialog::PrepareSendText(QString& question_string, QString& informative_text, QString& detailed_text)
{
QList<SendAssetsRecipient> recipients;
QList<SendAssetsRecipient> recipients;
bool valid = true;

for(int i = 0; i < ui->entries->count(); ++i)
Expand All @@ -303,6 +307,7 @@ bool SendCoinsDialog::PrepareSendText(QString& question_string, QString& informa
}
}
}
recipients += m_recipients;

if(!valid || recipients.isEmpty())
{
Expand Down Expand Up @@ -361,6 +366,11 @@ bool SendCoinsDialog::PrepareSendText(QString& question_string, QString& informa
}
}
formatted.append(recipientElement);

//Restricted assets should always have change set to go to the contract address
if(rcp.asset.isRestricted())
m_coin_control->destChange = DecodeDestination(rcp.asset.sIssuingaddress);

}

if (model->wallet().privateKeysDisabled()) {
Expand Down Expand Up @@ -430,6 +440,8 @@ bool SendCoinsDialog::PrepareSendText(QString& question_string, QString& informa
void SendCoinsDialog::send(const QList<SendAssetsRecipient> &recipients, QStringList formatted)
{
QString strFee = "";
qDebug() << __func__ << "1 : ";

// prepare transaction for getting txFee earlier
WalletModelTransaction currentTransaction(recipients);
WalletModel::SendCoinsReturn prepareStatus;
Expand All @@ -440,12 +452,14 @@ void SendCoinsDialog::send(const QList<SendAssetsRecipient> &recipients, QString
if(rcp.asset.isRestricted())
coinControl.destChange = DecodeDestination(rcp.asset.sIssuingaddress);
}
qDebug() << __func__ << "2 : ";

if (model->getOptionsModel()->getCoinControlFeatures()) // coin control enabled
prepareStatus = model->prepareTransaction(currentTransaction, coinControl);

// process prepareStatus and on error generate message shown to user
processSendCoinsReturn(prepareStatus,formatMultiAssetAmount(currentTransaction.getTransactionFee(), model->getOptionsModel()->getDisplayUnit(), CrownUnits::SeparatorStyle::ALWAYS, "\n"));
qDebug() << __func__ << "3 : ";

if(prepareStatus.status != WalletModel::OK) {
fNewRecipientAllowed = true;
Expand All @@ -455,6 +469,7 @@ void SendCoinsDialog::send(const QList<SendAssetsRecipient> &recipients, QString
CAmountMap txFee = currentTransaction.getTransactionFee();
QString questionString = tr("Are you sure you want to send?");
questionString.append("<br /><br />%1");
qDebug() << __func__ << "4 : ";

if(txFee > CAmountMap())
{
Expand All @@ -479,6 +494,7 @@ void SendCoinsDialog::send(const QList<SendAssetsRecipient> &recipients, QString
//if(u != model->getOptionsModel()->getDisplayUnit())
// alternativeUnits.append(CrownUnits::formatHtmlWithUnit(u, totalAmount));
}
qDebug() << __func__ << "5 : ";

// Show total amount + all alternative units
questionString.append(tr("Total Amount = <b>%1</b><br />= %2")
Expand All @@ -500,6 +516,7 @@ void SendCoinsDialog::send(const QList<SendAssetsRecipient> &recipients, QString
}
questionString.append("<hr />");
questionString.append(tr("<b>(%1 of %2 entries displayed)</b>").arg(displayedEntries).arg(messageEntries));
qDebug() << __func__ << "6 : ";

// Display message box
QMessageBox::StandardButton retval = QMessageBox::question(this, tr("Confirm send coins"),
Expand All @@ -512,18 +529,22 @@ void SendCoinsDialog::send(const QList<SendAssetsRecipient> &recipients, QString
fNewRecipientAllowed = true;
return;
}
qDebug() << __func__ << "7 : ";

// now send the prepared transaction
WalletModel::SendCoinsReturn sendStatus = model->sendCoins(currentTransaction);
// process sendStatus and on error generate message shown to user
processSendCoinsReturn(sendStatus);
qDebug() << __func__ << "8 : ";

if (sendStatus.status == WalletModel::OK)
{
accept();
coinControl.UnSelectAll();
coinControlUpdateLabels();
}
qDebug() << __func__ << "9 : ";

fNewRecipientAllowed = true;
}

Expand Down
1 change: 1 addition & 0 deletions src/qt/sendcoinsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class SendCoinsDialog : public QDialog
// of a message and message flags for use in Q_EMIT message().
// Additional parameter msgArg can be used via .arg(msgArg).
void processSendCoinsReturn(const WalletModel::SendCoinsReturn &sendCoinsReturn, const QString &msgArg = QString());
QList<SendAssetsRecipient> m_recipients;

public Q_SLOTS:
void clear();
Expand Down
3 changes: 2 additions & 1 deletion src/qt/sendcollateraldialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ void SendCollateralDialog::vsend(QList<SendAssetsRecipient> &recipients)
qDebug() << __func__ << "1 : ";
QStringList formatted = constructConfirmationMessage(recipients);
qDebug() << __func__ << "2 : ";
checkAndSend(recipients, formatted);
//checkAndSend(recipients, formatted);
send(recipients, formatted);
qDebug() << __func__ << "3 : ";
}

Expand Down

0 comments on commit 7d8f35e

Please sign in to comment.