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

Edit Chapter 13 #35

Merged
merged 4 commits into from
Jun 5, 2024

Conversation

edilmedeiros
Copy link
Contributor

Please take a separate look at these commits:

950b6fe: following #34 renaming, so it is consistent here. Will probably be necessary in the whole text going forward...

57400ab: I could not compile without it since we are pusshing into the vector, which requires it to be declared mut.

@edilmedeiros
Copy link
Contributor Author

I made no changes to the text about it, but I'm getting a warning at this point.

warning: fields `txid`, `output_index`, `script_sig`, and `sequence` are never read
 --> src/main.rs:5:5
  |
4 | struct Input {
  |        ----- fields in this struct
5 |     txid: [u8; 32],
  |     ^^^^
6 |     output_index: u32,
  |     ^^^^^^^^^^^^
7 |     script_sig: Vec<u8>,
  |     ^^^^^^^^^^
8 |     sequence: u32,
  |     ^^^^^^^^
  |
  = note: `Input` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis
  = note: `#[warn(dead_code)]` on by default
warning: `transaction-decoder` (bin "transaction-decoder") generated 1 warning

@sb1752
Copy link
Contributor

sb1752 commented Jun 3, 2024

Yeah probably worth mentioning that the compiler will give warning messages at this point since we're not doing anything with the struct yet.

@edilmedeiros edilmedeiros force-pushed the edilmedeiros-chapt13 branch from 57400ab to 2ce2469 Compare June 5, 2024 17:57
@edilmedeiros
Copy link
Contributor Author

I added a #[allow(dead_code)] annotation together with explanation about it.
Also dropped the commit renaming the script variable (see #39).

@@ -147,9 +173,11 @@ struct Input {
}
```

And voila! That works now and is much cleaner isn't it?
And voila! That works now and is much cleaner isn't it?
The attribute `#[allow(dead_code)]` is a hint to the compiler that we know we are not using the struct fields right now, but we will in the next section.
Copy link
Contributor

@sb1752 sb1752 Jun 5, 2024

Choose a reason for hiding this comment

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

oh good idea 👍

@sb1752
Copy link
Contributor

sb1752 commented Jun 5, 2024

Ack 2ce2469
This is perfect, thank you!

@sb1752 sb1752 merged commit 838d8c2 into bitcoin-dev-project:main Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants