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

Name

Description

wallet

The wallet funding and optionally signing the transaction.

vecSend

The recipients and amounts to pay.

change_pos

The position of the change output, or std::nullopt for a random position.

coin_control

Coin control settings governing input selection and fees.

sign

Whether to sign the created transaction.

Created with MrDocs