wallet::CreateTransaction

Create a new transaction paying the recipients with a set of coins selected by SelectCoins(); Also create the change output, when needed

Synopsis

Declared in <wallet/spend.h>

util::Result<CreatedTransactionResult>
CreateTransaction(
    CWallet& wallet,
    std::vector<CRecipient> const& vecSend,
    std::optional<unsigned int> change_pos,
    CCoinControl const& coin_control,
    bool sign = true);

Description

NOTE

passing change_pos as std::nullopt will result in setting a random position

Return Value

If successful, the created transaction and its fee details, otherwise an error.

Parameters

NameDescription
walletThe wallet funding and optionally signing the transaction.
vecSendThe recipients and amounts to pay.
change_posThe position of the change output, or std::nullopt for a random position.
coin_controlCoin control settings governing input selection and fees.
signWhether to sign the created transaction.