Allow CreateTransaction to return the values of the outputs

This commit is contained in:
Matt Corallo 2016-03-02 01:37:52 -08:00 committed by Gregory Sanders
parent 683dd3cdbe
commit fa413cb2a6
2 changed files with 6 additions and 2 deletions

View file

@ -2209,7 +2209,7 @@ bool CWallet::FundTransaction(CMutableTransaction& tx, CAmount& nFeeRet, bool ov
}
bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wtxNew, CReserveKey& reservekey, CAmount& nFeeRet,
int& nChangePosInOut, std::string& strFailReason, const CCoinControl* coinControl, bool sign)
int& nChangePosInOut, std::string& strFailReason, const CCoinControl* coinControl, bool sign, std::vector<CAmount> *outAmounts)
{
CAmount nValue = 0;
int nChangePosRequest = nChangePosInOut;
@ -2463,8 +2463,12 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
uint256 blind = coin.first->GetBlindingFactor(coin.second);
input_blinds.push_back(blind);
}
if(outAmounts)
outAmounts->clear();
for (size_t nOut = 0; nOut < txNew.vout.size(); nOut++) {
output_blinds.push_back(uint256());
if (outAmounts)
outAmounts->push_back(txNew.vout[nOut].nValue.GetAmount());
}
if (fBlindedIns && !fBlindedOuts) {
strFailReason = _("Confidential inputs without confidential outputs");

View file

@ -790,7 +790,7 @@ public:
* @note passing nChangePosInOut as -1 will result in setting a random position
*/
bool CreateTransaction(const std::vector<CRecipient>& vecSend, CWalletTx& wtxNew, CReserveKey& reservekey, CAmount& nFeeRet, int& nChangePosInOut,
std::string& strFailReason, const CCoinControl *coinControl = NULL, bool sign = true);
std::string& strFailReason, const CCoinControl *coinControl = NULL, bool sign = true, std::vector<CAmount> *outAmounts = NULL);
bool CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey);
bool AddAccountingEntry(const CAccountingEntry&, CWalletDB & pwalletdb);