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

Problems in spend_from_wallet #264

Closed
2 tasks
KnowWhoami opened this issue Sep 10, 2024 · 2 comments
Closed
2 tasks

Problems in spend_from_wallet #264

KnowWhoami opened this issue Sep 10, 2024 · 2 comments
Labels
bug Something isn't working
Milestone

Comments

@KnowWhoami
Copy link
Collaborator

KnowWhoami commented Sep 10, 2024

  • Take fee_rate instead of fee:

    • fee is always calculated from fee_rate & weight of tx and that's done after the creation of tx -> thus it's rational to take fee_rate instead of fee in the parameters.
  • check whether it's feasible to spend given amount.

    • when send_amount= SendAmount::Amount , then we directly consider the given amount as utxo output value and we do not check whether it's feasible to send that amount or not.

    • If the change amount i.e (remaining= total_input_value- fee-amount - amount) > minimal_dust_amt -> then a change utxo is created while deducting fee from remaining.

    • But there are two edges :

    amount ~= total_input_value && amount> total_input_value:

    • created utxo value= amount even if it is practically not possible to do so.
    • 1'st case: remaining < minimal_dust_amt -> no fee deducted.
    • 2'nd case -> (total_input_value < amount) -> panic occurs due to overflow
@KnowWhoami KnowWhoami changed the title Problems in spend_from_wallet: Problems in spend_from_wallet Sep 10, 2024
@KnowWhoami KnowWhoami added the bug Something isn't working label Sep 10, 2024
@KnowWhoami KnowWhoami added this to the v0.1.0 milestone Sep 10, 2024
@mojoX911
Copy link

Take fee_rate instead of fee:

Probably better to just to stick with fee. Refer #244 (comment)

Rest are good fixes.

@mojoX911
Copy link

This is duplicate of #309

@mojoX911 mojoX911 removed this from core lib Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants