Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RPC][Wallet] Create multiple transactions with one command. #991

Merged
merged 1 commit into from
Apr 23, 2022

Conversation

Zannick
Copy link
Collaborator

@Zannick Zannick commented Mar 13, 2022

Details

RPC send commands have a new argument inputs_per_tx that controls whether the amount specified can be split across multiple transactions. This value ranges from 0 (default) to 32 (an upper bound designed to prevent transactions larger than can be accepted). When set to 0, attempts to fit the send in one transaction as per previous behavior.

The sends are interpreted to mean that the recipient will receive the sent amount, but under the hood the transactions are created as if subtractfeefromamount was specified. In particular, if the send needs to be split into n > 1 transactions, the outputs of the first n - 1 are randomly reduced to account for the fee (and the shortfall from the inputs).

Coins are selected using a sliding window that prioritizes cleaning up small utxos (dust) over using fewer inputs, and thus transactions built this way will tend toward having more inputs. This is beneficial for ringct staking (keeping larger coins intact and reducing the amount of small utxos). The smallest utxo is always included if possible to prevent the amount of small utxos from increasing with usage.

Tested

On regtest some months ago.

@Zannick Zannick added Component: Wallet Relating to keystore, tx creation, and balance tracking Component: RPC Related to the console commands themselves. Coin Type: RingCT Specifically related to RingCT transactions Coin Type: Basecoin Specifically related to basecoin transactions Coin Type: CT Specifically related to CT transactions Tag: Transaction Creation Related to the transaction creation process. Tag: Waiting For Code Review Waiting for code review from a core developer labels Mar 13, 2022
@Zannick Zannick self-assigned this Mar 13, 2022
@Zannick
Copy link
Collaborator Author

Zannick commented Mar 13, 2022

random_shuffle is removed in C++17 so I'll look into replacing it with std::shuffle which is available but takes a slightly different 3rd argument.

RPC send commands have a new argument now that controls whether
the amount specified can be split across multiple transactions.
It defaults to single-transaction mode for now.

SelectCoinsForOneTx: use a sliding window algorithm to pick inputs.
This will pick one small input if possible, so that if change is
produced it does not result in an ever-growing pile of tiny utxos.
@Zannick
Copy link
Collaborator Author

Zannick commented Mar 15, 2022

Changed to use Shuffle() from random.h per other uses.

@WetOne
Copy link
Collaborator

WetOne commented Mar 18, 2022

utACK a872b41

Copy link
Owner

@Veil-Project Veil-Project left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK a872b41

@codeofalltrades codeofalltrades merged commit c81d57f into Veil-Project:master Apr 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Coin Type: Basecoin Specifically related to basecoin transactions Coin Type: CT Specifically related to CT transactions Coin Type: RingCT Specifically related to RingCT transactions Component: RPC Related to the console commands themselves. Component: Wallet Relating to keystore, tx creation, and balance tracking Tag: Transaction Creation Related to the transaction creation process. Tag: Waiting For Code Review Waiting for code review from a core developer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants