Skip to content
Snippets Groups Projects

[fix] #296 : Prevent sending transaction with 0 as amounts

Merged [fix] #296 : Prevent sending transaction with 0 as amounts
All threads resolved!
Merged atrax requested to merge atrax/silkaj:296_prevent_amount_0 into dev
All threads resolved!

Fix issue with --allSources creating a transaction when balance is 0. Tests will be written when #213 (closed) is merged.

Close #296 (closed).

Edited by Moul

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • @moul I first thought about implementing it through Click. However from what I understand --allSources is a flag option that sends all the sources from the sender's pubkey to the recipient. So I inferred that in order to check whether the amount is 0 we first need to get this amount, which happens after the arguments are parsed by Click.

    However, --amount is handled through Click whereas --amountUD is handled here.

    I guess it would be more efficient to handle --amountUD through Click (which I can do quickly), but I don't see how I could possibly do it for --allSources.

    Did I get it wrong ?

    • Resolved by Moul

      Good catch, in fact there is also an issue with --allSources when the balance of the pubkey is null. So, when:

      • --allSources is passed, check if the balance is positive. Click can't be used in this case as far as I can tell.
      • --amountUD is passed, filter with Click small amounts, but still let small amount pass. I would set the minimum value to 0.001 for Ğ1 currency. This value can be lowered to 0.00001 to allow smaller tx on Ğ1-test.
      • --amount is already handled
  • matograine
  • assigned to @matograine

  • atrax added 1 commit

    added 1 commit

    Compare with previous version

  • atrax added 1 commit

    added 1 commit

    Compare with previous version

  • Nice !

    • don't hesitate to use git push --force, so all little changes (formats, etc.) are in the same commit. I think all your changes should fit in one only commit. (if you disagree, just tell me).

    • I don't know if you installed pre-commit. I recommend it for next developments, it will prevent such little formatting problems.

    • you can re-launch tests for Py-v3.9 on your pipeline. Tests frequently fail, we just have to re-launch them :-)

    Once all this is done, I think I can approve.

    Edited by matograine
  • Moul
  • Moul
  • atrax added 1 commit

    added 1 commit

    Compare with previous version

  • atrax added 1 commit

    added 1 commit

    Compare with previous version

  • atrax added 1 commit

    added 1 commit

    Compare with previous version

  • The : should be shown. Maybe the user only made a mistake in the credentials. Hint : you may use display_pubkey_and_checksum()

    Done

    don't hesitate to use git push --force, so all little changes (formats, etc.) are in the same commit. I think all your changes should fit in one only commit. (if you disagree, just tell me).

    I usually don't use --force but if it's ok in your workflow I can use it :)

    I don't know if you installed pre-commit. I recommend it for next developments, it will prevent such little formatting problems.

    Will do soon-ish

    you can re-launch tests for Py-v3.9 on your pipeline. Tests frequently fail, we just have to re-launch them :-)

    WIP

    Can you use the f-string feature? Regarding the text, I would replace "0" by "null" or say the "pubkey is empty"

    Done. I prefer empty over null, the former sounding more user-friendly to me than the latter. Is it ok for you ?

    Can you check when <= 0 to be on the safe side.

    Done

  • Done. I prefer empty over null, the former sounding more user-friendly to me than the latter. Is it ok for you ?

    As you like. I am fine with both. I prefer the empty one. Thanks.

  • atrax added 1 commit

    added 1 commit

    Compare with previous version

  • atrax added 2 commits

    added 2 commits

    Compare with previous version

  • Moul resolved all threads

    resolved all threads

  • Moul changed the description

    changed the description

  • Moul
  • Moul resolved all threads

    resolved all threads

  • The code looks good to me. Great work! Waiting for the tests. I will try to finish my review on #213 (closed).

  • The code looks good to me

    It still needs a rebase on current dev branch (@moul added changes, and I corrected a broken integration test)

    Waiting for the tests.

    I would rather write them in !130 (merged) so the style and values are coherent.

    So I propose we merge it right after the rebase.

    Edited by Moul
  • atrax added 7 commits

    added 7 commits

    Compare with previous version

  • It still needs a rebase on current dev branch (@moul added changes, and I corrected a broken integration test)

    Done. Waiting for the tests to pass.

  • matograine approved this merge request

    approved this merge request

  • Moul approved this merge request

    approved this merge request

  • merged

  • mentioned in issue #362 (closed)

  • matograine mentioned in merge request !130 (merged)

    mentioned in merge request !130 (merged)

  • Please register or sign in to reply
    Loading