src/namecoin.cpp
// nTxOut is the output from wtxIn that we should grab
// requires cs_main lock
nTxOut is the output from wtxIn that we should grab
requires cs_main lock
nTxOut is the output from wtxIn that we should grab requires cs_main lock
string SendMoneyWithInputTx(CScript scriptPubKey, int64 nValue, int64 nNetFee, CWalletTx& wtxIn, CWalletTx& wtxNew, bool fAskFee)
{
    int nTxOut = IndexOfNameOutput(wtxIn);
    CReserveKey reservekey(pwalletMain);
    int64 nFeeRequired;
    vector< pair<CScript, int64> > vecSend;
    vecSend.push_back(make_pair(scriptPubKey, nValue));
    if (nNetFee)
    {
        CScript scriptFee;
        scriptFee << OP_RETURN;
        vecSend.push_back(make_pair(scriptFee, nNetFee));
    }
    if (!CreateTransactionWithInputTx(vecSend, wtxIn, nTxOut, wtxNew, reservekey, nFeeRequired))
    {
        string strError;
        if (nValue + nFeeRequired > pwalletMain->GetBalance())
            strError = strprintf(_("Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds "), FormatMoney(nFeeRequired).c_str());
        else
            strError = _("Error: Transaction creation failed  ");
        printf("SendMoney() : %s", strError.c_str());
        return strError;
    }
    if (fAskFee && !ThreadSafeAskFee(nFeeRequired, _("Sending..."), NULL))
        return "ABORTED";
    if (!pwalletMain->CommitTransaction(wtxNew, reservekey))
        return _("Error: The transaction was rejected.  This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.");
    MainFrameRepaint();
    return "";
}
string SendMoneyWithInputTx ( CScript scriptPubKey , int64 nValue , int64 nNetFee , CWalletTx & wtxIn , CWalletTx & wtxNew , bool fAskFee ) { int nTxOut = IndexOfNameOutput ( wtxIn ) ; CReserveKey reservekey ( pwalletMain ) ; int64 nFeeRequired ; vector < pair < CScript , int64 > > vecSend ; vecSend . push_back ( make_pair ( scriptPubKey , nValue ) ) ; if ( nNetFee ) { CScript scriptFee ; scriptFee << OP_RETURN ; vecSend . push_back ( make_pair ( scriptFee , nNetFee ) ) ; } if ( ! CreateTransactionWithInputTx ( vecSend , wtxIn , nTxOut , wtxNew , reservekey , nFeeRequired ) ) { string strError ; if ( nValue + nFeeRequired > pwalletMain -> GetBalance ( ) ) strError = strprintf ( _ ( " " ) , FormatMoney ( nFeeRequired ) . c_str ( ) ) ; else strError = _ ( " " ) ; printf ( " " , strError . c_str ( ) ) ; return strError ; } if ( fAskFee && ! ThreadSafeAskFee ( nFeeRequired , _ ( " " ) , NULL ) ) return " " ; if ( ! pwalletMain -> CommitTransaction ( wtxNew , reservekey ) ) return _ ( " " ) ; MainFrameRepaint ( ) ; return " " ; }
nTxOut is the output from wtxIn that we should grab
requires cs_main lock
nTxOut is the output from wtxIn that we should grab requires cs_main lock