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

fix: check outputs of miner transaction #96

Merged
merged 3 commits into from
Jun 29, 2022

Conversation

h4sh3d
Copy link
Member

@h4sh3d h4sh3d commented Jun 29, 2022

Fix #83

On coinbase transactions the amount is in clear with a RctType::Null, this PR fixes the logic to handle that case. Data for check_output_on_miner_tx test has been generated with monerod and monero-wallet-cli in regtest mode.

@codecov
Copy link

codecov bot commented Jun 29, 2022

Codecov Report

Merging #96 (cef84cf) into main (8102ddc) will increase coverage by 0.5%.
The diff coverage is 95.6%.

@@           Coverage Diff           @@
##            main     #96     +/-   ##
=======================================
+ Coverage   75.8%   76.3%   +0.5%     
=======================================
  Files         16      16             
  Lines       2124    2169     +45     
=======================================
+ Hits        1610    1657     +47     
+ Misses       514     512      -2     
Impacted Files Coverage Δ
src/blockdata/transaction.rs 58.6% <83.3%> (+0.2%) ⬆️
tests/blockdata.rs 99.0% <95.0%> (-1.0%) ⬇️
tests/recover_outputs.rs 100.0% <100.0%> (ø)
src/consensus/encode.rs 72.0% <0.0%> (+1.1%) ⬆️
src/util/key.rs 61.7% <0.0%> (+1.4%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8102ddc...cef84cf. Read the comment docs.

@h4sh3d h4sh3d marked this pull request as ready for review June 29, 2022 09:18
@h4sh3d h4sh3d requested a review from TheCharlatan June 29, 2022 09:18
@h4sh3d h4sh3d added this to the v0.17.0 milestone Jun 29, 2022
@h4sh3d h4sh3d added the bug Something isn't working label Jun 29, 2022
Copy link
Member

@TheCharlatan TheCharlatan left a comment

Choose a reason for hiding this comment

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

I'm surprised this was such a small change - nice change to test lines ratio :)

I don't think it is relevant, because the output will be unspendable, but what are the side effects, when a miner creates a 0 amount output, but the amount function returns None?

@h4sh3d
Copy link
Member Author

h4sh3d commented Jun 29, 2022

I don't think it is relevant, because the output will be unspendable, but what are the side effects, when a miner creates a 0 amount output, but the amount function returns None?

Currently the reason I see to continue returning None in the library is because OwnedTxOut can be created with rct_sig_base set to null and the 0 amount is not a coinbase with 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging this pull request may close these issues.

Can't check outputs of miner transaction
2 participants