-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
wallet: feature: transfer amount with fee included #8861
wallet: feature: transfer amount with fee included #8861
Conversation
This closes #7980 |
Depends on #8888 |
e247a33
to
041a695
Compare
This is a needed feature for application developers which I will be using too. Is anything else needed before merging? @luigi1111 |
@jeffro256 Please rebase on master. |
@@ -1086,7 +1092,7 @@ namespace tools | |||
{ | |||
uint64_t mixin = m_wallet->adjust_mixin(req.ring_size ? req.ring_size - 1 : 0); | |||
uint32_t priority = m_wallet->adjust_priority(req.priority); | |||
std::vector<wallet2::pending_tx> ptx_vector = m_wallet->create_transactions_2(dsts, mixin, req.unlock_time, priority, extra, req.account_index, req.subaddr_indices); | |||
std::vector<wallet2::pending_tx> ptx_vector = m_wallet->create_transactions_2(dsts, mixin, req.unlock_time, priority, extra, req.account_index, req.subaddr_indices, req.subtract_fee_from_outputs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs added to on_transfer_split
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me, it doesn't make as much sense to add this to the split transfer interface since the fees have to be paid out of certain destinations. If those certain destinations are split over multiple transactions, it's unclear which destinations should pay for transactions if a transaction doesn't contain any "subtractable" destinations. Also, this feature can be expanded upon in a future PR for reviewer's sake, and I'd imagine this feature is mainly useful for small transfers (like customers paying for an item with fee included).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simplewallet.cpp already permits applying this feature across split transactions, so either that behavior needs to be well defined and supported or completely disabled.
Then monero-wallet-rpc should be consistent. So if we don't support transfer_split
in monero-wallet-rpc now, this feature should be disabled for split transactions in simplewallet too.
As far as I can tell, the expected behavior with split transactions should be clear, where the fee is split across any specified destinations in each transaction, and the entire call fails if any transaction cannot be created with subtractable destinations. So my preference is to support this.
f1fbde1
to
6a28ed4
Compare
There was an issue but rebasing was fixed |
@jeffro256 Do you mind to PR this on the release branch in addition to the master branch, so I can cherry-pick only what is necessary for my next release? Otherwise I would have to base on master which has diverged from the release branch, so it's unofficial and could be risky. |
6a28ed4
to
3cc4b57
Compare
In the latest commit, I explicitly disabled using this feature split over multiple transactions to avoid user confusion. |
3cc4b57
to
b20197e
Compare
@jeffro256 mind updating the release PR too? |
This pull request provides critical functionality to deduct and split the mining fee among transfer amounts. Haveno relies heavily on this feature in its trade protocol. Happy to help move this forward however possible. |
b20197e
to
0dc77f1
Compare
Rebased. Will acknowledge @vtnerd's comments soon... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One minor question.
Thanks for your updates @jeffro256. I can test it in the libraries and applications once the release PR is rebased. |
ec65958
to
800c188
Compare
I tested the latest release branch with #8945 and it's passing my tests. Should that PR be taken out of draft mode @jeffro256? |
I'll keep it in draft mode as long as this PR is awaiting approval |
Understood. @vtnerd approved these changes last week, so I guess we are just waiting on any other approvals. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please bump WALLET_RPC_VERSION_MINOR
800c188
to
b4eb3f1
Compare
Done |
Oh shoot you're right. I always get those mixed up |
To transfer ~5 XMR to an address such that your balance drops by exactly 5 XMR, provide a `subtractfeefrom` flag to the `transfer` command. For example: transfer 76bDHojqFYiFCCYYtzTveJ8oFtmpNp3X1TgV2oKP7rHmZyFK1RvyE4r8vsJzf7SyNohMnbKT9wbcD3XUTgsZLX8LU5JBCfm 5 subtractfeefrom=all If my walet balance was exactly 30 XMR before this transaction, it will be exactly 25 XMR afterwards and the destination address will receive slightly less than 5 XMR. You can manually select which destinations fund the transaction fee and which ones do not by providing the destination index. For example: transfer 75sr8AAr... 3 74M7W4eg... 4 7AbWqDZ6... 5 subtractfeefrom=0,2 This will drop your balance by exactly 12 XMR including fees and will spread the fee cost proportionally (3:5 ratio) over destinations with addresses `75sr8AAr...` and `7AbWqDZ6...`, respectively. Disclaimer: This feature was paid for by @LocalMonero.
b4eb3f1
to
b13c5f6
Compare
Looks like the logic from monero-project#8882 was accidentally removed in monero-project#8861 (regressing to the behavior noted in the monero-project#8882 description). This commit brings that logic back.
Looks like the logic from monero-project#8882 was accidentally removed in monero-project#8861 (regressing to the behavior noted in the monero-project#8882 description). This commit brings that logic back.
To transfer ~5 XMR to an address such that your balance drops by exactly 5 XMR, provide a
subtractfeefrom
flag to thetransfer
command. For example:If my walet balance was exactly 30 XMR before this transaction, it will be exactly 25 XMR afterwards and the destination address will receive slightly less than 5 XMR. You can manually select which destinations fund the transaction fee and which ones do not by providing the destination index. For example:
This will drop your balance by exactly 12 XMR including fees and will spread the fee cost equally over destinations with addresses
75sr8AAr...
and7AbWqDZ6...
.This feature was requested by @LocalMonero.