Ready for Review: Clean up network::encodable and network::serialize#156
Conversation
307ec2e to
ed5a358
Compare
network::encodable and network::serializenetwork::encodable and network::serialize
ed5a358 to
8f982ff
Compare
|
Rebased. |
2949f70 to
a3a8b74
Compare
a3a8b74 to
5c4ca24
Compare
|
Rebased. |
src/util/hash.rs
Outdated
There was a problem hiding this comment.
Is this used anywhere? It's pretty surprising that the "bitcoin hash" of a Vec does not include its length prefix.
There was a problem hiding this comment.
Like, the merkle_root() method calls .bitcoin_hash() on a Vec<u8>? Yeah, that should be made more explicit.
There was a problem hiding this comment.
Can you add a commit fixing merkle_root to use Sha256dEncoder and then fix this commit so it doesn't add useless code?
There was a problem hiding this comment.
Addressed in: ba84548c8e13a4fd83dde417970cd5f2e9e995c6
Not sure which commit you mean?
src/consensus/mod.rs
Outdated
There was a problem hiding this comment.
Can you add a pub use params::Params here so that people can use this as bitcoin::consensus::Params?
There was a problem hiding this comment.
Can you change this commit to address this?
There was a problem hiding this comment.
Addressed in: cccbb057bc88462284430b91ea333ea13ecbf7b0
src/consensus/encode.rs
Outdated
There was a problem hiding this comment.
Should be renamed to Encoder. Ditto for SimpleDecoder.
There was a problem hiding this comment.
Addressed in: 58b66001fdfa538dae9448c05ac1f307a8225d97
src/consensus/encode.rs
Outdated
There was a problem hiding this comment.
We should drop RawEncoder and just do an impl<T: Write> Encoder for T, the way ReadExtBytes in byteorder works. Similar for RawDecoder.
There was a problem hiding this comment.
Addressed in: 58b66001fdfa538dae9448c05ac1f307a8225d97
src/consensus/mod.rs
Outdated
There was a problem hiding this comment.
Should also pub use Encoder and Decoder (suggested renames of SimpleEncoder and SimpleDecoder)
There was a problem hiding this comment.
and deserialize and serialize
There was a problem hiding this comment.
Addressed in: cccbb057bc88462284430b91ea333ea13ecbf7b0
src/consensus/encode.rs
Outdated
There was a problem hiding this comment.
We should just unwrap in here, not return an error, and document in the Encodable trait that you should only ever error if the underlying Encoder errors.
There was a problem hiding this comment.
Addressed in: efb85a1f5d74ba1ef8b5d7c4779b467cb2831488
src/util/hash.rs
Outdated
There was a problem hiding this comment.
We should impl Write for this rather than SimpleEncoder, then the default impl for all Writes can take over.
There was a problem hiding this comment.
Addressed in: 4f76787dcf6c1a673c08bed7bdcb9ed2fe5864b3
2ba4074 to
d66a34b
Compare
|
Done. |
|
Can you rebase everything so I can just review the whole changeset again? |
|
@apoelstra rebase over...? Confused. |
|
@dongcarl use |
d66a34b to
c4f4d5f
Compare
|
@apoelstra Squashed commits together that only |
|
Retriggering Travis. |
|
Does anyone know why it's not testing the latest commit? |
c4f4d5f to
bac7a9d
Compare
|
Looks like it's working now. |
|
@dongcarl I need a history where my nits are addressed. I can't tell where or if you've fixed things when they're all spread around. |
bac7a9d to
4f76787
Compare
|
@apoelstra I've split the commits up a little more so it's obvious what's addressing what, I've also commented the relevant commits on your reviews, 58b66001fdfa538dae9448c05ac1f307a8225d97 is a little too convoluted to split up in reasonable time 🙁 |
- Modify VersionMessage constructor to take in parameters directly that would have otherwise been extracted from a Socket (now removed)
- Use Sha256dEncoder for calculating merkle root - Remove BitcoinHash implementation for Vec<u8>
- Move network::encodable::* to consensus::encode::*
- Rename Consensus{En,De}codable to {En,De}codable (now under
consensus::encode)
- Move network::serialize::Error to consensus::encode::Error
- Remove Raw{En,De}coder, implement {En,De}coder for T: {Write,Read}
instead
- Move network::serialize::Simple{En,De}coder to
consensus::encode::{En,De}coder
- Rename util::Error::Serialize to util::Error::Encode
- Modify comments to refer to new names
- Modify files to refer to new names
- Expose {En,De}cod{able,er}, {de,}serialize, Params
- Do not return Result for serialize{,_hex} as serializing to a Vec
should never fail
4f76787 to
c42252c
Compare
Bump bitcoin dependency to 0.26
Changed miri tests passing
…rust-bitcoin#156) * fix: add a BIP32 path to Default wallet creation options * fix: increase gap limits to match Android and iOS defaults * chore: fix special gap limit comment * fix: add BIP32 account 0 to create_accounts_with_passphrase_from_options * style: format to pass fmt * tests: update tests for adding BIP32 to Default wallet * style: add missing , * chore: remove unused import * chore: fix comment in test * fix: lower gap limits based on testing with one old wallet from 2019 * style: fix format
Closes: #155