Skip to content

Commit 2d596f1

Browse files
committed
Merge 8c9268c into merged_master (Elements PR ElementsProject#1223)
2 parents 9baaa43 + 8c9268c commit 2d596f1

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/qt/sendcoinsdialog.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -791,21 +791,25 @@ void SendCoinsDialog::useAvailableBalance(SendCoinsEntry* entry)
791791
// Include watch-only for wallets without private key
792792
m_coin_control->fAllowWatchOnly = model->wallet().privateKeysDisabled() && !model->wallet().hasExternalSigner();
793793

794+
SendAssetsRecipient recipient = entry->getValue();
794795
// Calculate available amount to send.
795-
CAmount amount = valueFor(model->wallet().getAvailableBalance(*m_coin_control), ::policyAsset);
796+
CAmount amount = valueFor(model->wallet().getAvailableBalance(*m_coin_control), recipient.asset);
796797
for (int i = 0; i < ui->entries->count(); ++i) {
797798
SendCoinsEntry* e = qobject_cast<SendCoinsEntry*>(ui->entries->itemAt(i)->widget());
798-
if (e && !e->isHidden() && e != entry && e->getValue().asset == ::policyAsset) {
799+
if (e && !e->isHidden() && e != entry && e->getValue().asset == recipient.asset) {
799800
amount -= e->getValue().asset_amount;
800801
}
801802
}
802803

803804
if (amount > 0) {
804-
entry->checkSubtractFeeFromAmount();
805-
entry->setAmount(amount);
805+
if (recipient.asset == ::policyAsset) {
806+
entry->checkSubtractFeeFromAmount();
807+
}
808+
recipient.asset_amount = amount;
806809
} else {
807-
entry->setAmount(0);
810+
recipient.asset_amount = 0;
808811
}
812+
entry->setValue(recipient);
809813
}
810814

811815
void SendCoinsDialog::updateFeeSectionControls()

0 commit comments

Comments
 (0)