Avoid using numeric_limits for sequence numbers and lock times#14636
Conversation
The deleted LOC is a dup so far as `std::numeric_limits<unsigned int>::min()` == 0
Switches to named constants, because numeric_limits calls can be harder to read and less portable. Change was suggested by James O'Beirne <james.obeirne@gmail.com> in bitcoin#10973 (comment) There are no changes in behavior except on some platforms we don't support (ILP64, IP16L32, I16LP32), where SignalsOptInRBF() and MutateTxAddInput() functions would now work correctly.
|
Tagged "refactoring" because the platforms that are broken are supposedly not supported. |
|
utACK 8041cd3 |
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsNo conflicts as of last run. |
|
@ryanofsky Can you combine the test change from #14463 into this? I'll close that PR, as this has more extensive changes. |
|
Updated 8041cd3 -> 90a9e72 (pr/climit.1 -> pr/climit.2) adding commits from #14463 |
|
Updated 90a9e72 -> 5352030 (pr/climit.2 -> pr/climit.3) adding U suffix (doesn't hurt to be explicit). |
|
@ryanofsky I think the More specifically that the integer literal of That assumption is false :-) Proof: |
|
The u suffix isn't needed, but it's nice because it makes it more obvious that compiler will choose an unsigned type. (According to the "type of the literal" table in https://en.cppreference.com/w/cpp/language/integer_literal, the compiler without the u would choose smallest signed or unsigned type that holds the value.) |
|
ACK 5352030 |
|
utACK 5352030 |
…and lock times 5352030 Avoid using numeric_limits for sequence numbers and lock times (Russell Yanofsky) bafb921 Remove duplicated code (Hennadii Stepanov) e4dc39b Replace platform dependent type with proper const (Hennadii Stepanov) Pull request description: Switches to named constants, because numeric_limits calls can be harder to read and less portable. Change was suggested by jamesob in bitcoin#10973 (comment) There are no changes in behavior except on some platforms we don't support (ILP64, IP16L32, I16LP32), where `SignalsOptInRBF` and `MutateTxAddInput` functions would now work correctly. Tree-SHA512: 3f5c6393c260551f65a0edfba55ef7eb3625232eec8d85b1457f26e144aa0b90c7ef5f44b2fd2f7d9be3c3bcb301030a9f5473c21b3bac566cc59b8c8780737c
Merges bitcoin#14636: Avoid using numeric_limits for sequence numbers and lock times. 5352030 Avoid using numeric_limits for sequence numbers and lock times (Russell Yanofsky) bafb921 Remove duplicated code (Hennadii Stepanov) e4dc39b Replace platform dependent type with proper const (Hennadii Stepanov) Pull request description: Switches to named constants, because numeric_limits calls can be harder to read and less portable. Change was suggested by jamesob in bitcoin#10973 (comment) There are no changes in behavior except on some platforms we don't support (ILP64, IP16L32, I16LP32), where `SignalsOptInRBF` and `MutateTxAddInput` functions would now work correctly.
…and lock times (#4296) Merges bitcoin#14636: Avoid using numeric_limits for sequence numbers and lock times. 5352030 Avoid using numeric_limits for sequence numbers and lock times (Russell Yanofsky) bafb921 Remove duplicated code (Hennadii Stepanov) e4dc39b Replace platform dependent type with proper const (Hennadii Stepanov) Pull request description: Switches to named constants, because numeric_limits calls can be harder to read and less portable. Change was suggested by jamesob in bitcoin#10973 (comment) There are no changes in behavior except on some platforms we don't support (ILP64, IP16L32, I16LP32), where `SignalsOptInRBF` and `MutateTxAddInput` functions would now work correctly.
Switches to named constants, because numeric_limits calls can be harder to read and less portable.
Change was suggested by jamesob in #10973 (comment)
There are no changes in behavior except on some platforms we don't support (ILP64, IP16L32, I16LP32), where
SignalsOptInRBFandMutateTxAddInputfunctions would now work correctly.