WitnessVersion type#617
WitnessVersion type#617apoelstra merged 2 commits intorust-bitcoin:masterfrom BP-WG:feat/witness-version
Conversation
sgeisler
left a comment
There was a problem hiding this comment.
utACK 3645c6353757a1771799a7ec35bd1a29d34538c3
Looks pretty good. I really like the function documentation describing all error cases applicable to the function (especially when it's only a subset of the error enum).
jrawsthorne
left a comment
There was a problem hiding this comment.
You mentioned here about using WitnessVersion in the is_* methods on Script. Don't know if you want to do that here.
|
@jrawsthorne well, tried that and it looks like it adds a lot more code instead of simplifying functions. So just made it for only |
clarkmoody
left a comment
There was a problem hiding this comment.
I prefer this approach, since it "makes impossible states impossible." I've just got a couple preference nits.
src/util/address.rs
Outdated
There was a problem hiding this comment.
Nit: use num instead of no for a number variable? Also, this function would probably be better named from_u8
There was a problem hiding this comment.
It was originally named from_u8, but later I decided it is a bad name, since there are two different u8-based representations for witness version: by script byte (0, 0x51-0x60) and as version number (incremental from 0 to 16). So while I'm fine with using from_num instead of from_no, it will be confusing to use from_u8.
There was a problem hiding this comment.
Possibly raw_num or raw_u8?
src/util/address.rs
Outdated
There was a problem hiding this comment.
Commented above: the same reason for the naming here
Kixunil
left a comment
There was a problem hiding this comment.
Just a few doc suggestions.
src/util/address.rs
Outdated
There was a problem hiding this comment.
Did you mean to say "if a plain u8 type was used instead it would mean that version may be > 16, which is incorrect"?
src/util/address.rs
Outdated
There was a problem hiding this comment.
I believe s.parse::<u8>() is considered idiomatic.
src/util/address.rs
Outdated
There was a problem hiding this comment.
Not a native speaker but the original seemed correct. The rules check if the address is standard.
|
Addressed all suggestions with a separate commit |
src/util/address.rs
Outdated
sanket1729
left a comment
There was a problem hiding this comment.
ack 4ecfd689d1fa8da4aed9d9a265f73c1ef3f1160f
|
Needed rebase, merged master into this branch so the review will not require to go through all commits again. Also fixed @Kixunil nit in docs. Ned re-ACK from @sanket1729 and review from @apoelstra before the merge since this is intrusive and important change |
sgeisler
left a comment
There was a problem hiding this comment.
utACK 409cb919c5586b5fb39bd72dba3b73e433c379ad
sgeisler
left a comment
There was a problem hiding this comment.
utACK 8a99a3fddce43001223774fe0d58dfc1457394bb
|
Can you clean up the history by removing the merge commit and rebasing on top of master? |
|
ack 8a99a3fddce43001223774fe0d58dfc1457394bb aside from history |
|
@apoelstra done |
sanket1729
left a comment
There was a problem hiding this comment.
ACK a8571f24cb3d50289acc86a6fe72f4ecc615cee8
|
@sanket1729 @sgeisler had to force-push due to conflicts with recent merges. Re-ACK will be highly appreciated |
|
re-utACK ecc4008 |
Reopening as a new PR to #562 (github does not allow to re-open force-pushed branches) since there might be changes during the review at this level unrelated to #563 (which will be in draft mode until this is merged - and rebased after the merge)