@@ -220,6 +220,36 @@ void SendCoinsDialog::on_sendButton_clicked()
220
220
return ;
221
221
}
222
222
223
+ fNewRecipientAllowed = false ;
224
+
225
+
226
+ WalletModel::UnlockContext ctx (model->requestUnlock ());
227
+ if (!ctx.isValid ())
228
+ {
229
+ // Unlock wallet was cancelled
230
+ fNewRecipientAllowed = true ;
231
+ return ;
232
+ }
233
+
234
+ // prepare transaction for getting txFee earlier
235
+ WalletModelTransaction currentTransaction (recipients);
236
+ WalletModel::SendCoinsReturn prepareStatus;
237
+ if (model->getOptionsModel ()->getCoinControlFeatures ()) // coin control enabled
238
+ prepareStatus = model->prepareTransaction (currentTransaction, CoinControlDialog::coinControl);
239
+ else
240
+ prepareStatus = model->prepareTransaction (currentTransaction);
241
+
242
+ // process prepareStatus and on error generate message shown to user
243
+ processSendCoinsReturn (prepareStatus,
244
+ BitcoinUnits::formatWithUnit (model->getOptionsModel ()->getDisplayUnit (), currentTransaction.getTransactionFee ()));
245
+
246
+ if (prepareStatus.status != WalletModel::OK) {
247
+ fNewRecipientAllowed = true ;
248
+ return ;
249
+ }
250
+
251
+ CAmount txFee = currentTransaction.getTransactionFee ();
252
+
223
253
// Format confirmation message
224
254
QStringList formatted;
225
255
foreach (const SendCoinsRecipient &rcp, recipients)
@@ -257,35 +287,6 @@ void SendCoinsDialog::on_sendButton_clicked()
257
287
formatted.append (recipientElement);
258
288
}
259
289
260
- fNewRecipientAllowed = false ;
261
-
262
-
263
- WalletModel::UnlockContext ctx (model->requestUnlock ());
264
- if (!ctx.isValid ())
265
- {
266
- // Unlock wallet was cancelled
267
- fNewRecipientAllowed = true ;
268
- return ;
269
- }
270
-
271
- // prepare transaction for getting txFee earlier
272
- WalletModelTransaction currentTransaction (recipients);
273
- WalletModel::SendCoinsReturn prepareStatus;
274
- if (model->getOptionsModel ()->getCoinControlFeatures ()) // coin control enabled
275
- prepareStatus = model->prepareTransaction (currentTransaction, CoinControlDialog::coinControl);
276
- else
277
- prepareStatus = model->prepareTransaction (currentTransaction);
278
-
279
- // process prepareStatus and on error generate message shown to user
280
- processSendCoinsReturn (prepareStatus,
281
- BitcoinUnits::formatWithUnit (model->getOptionsModel ()->getDisplayUnit (), currentTransaction.getTransactionFee ()));
282
-
283
- if (prepareStatus.status != WalletModel::OK) {
284
- fNewRecipientAllowed = true ;
285
- return ;
286
- }
287
-
288
- CAmount txFee = currentTransaction.getTransactionFee ();
289
290
QString questionString = tr (" Are you sure you want to send?" );
290
291
questionString.append (" <br /><br />%1" );
291
292
0 commit comments