msvc compile broken by new varint encoding checks #12732

issue sipsorcery opened this issue on March 20, 2018
  1. sipsorcery commented at 3:19 AM on March 20, 2018: member

    The commit for #9573 has broken the ability to compile libbitcoin_server and the test and bench programs.

    The compiler error is:

    Error C2338 Signed type required with mode NONNEGATIVE_SIGNED. libbitcoin_server f:\dev\github\bitcoin-msvc\src\serialize.h 316

    It looks like the static_assert in serialize.h is now more aggressively checking inputs. I've tracked down one of the static_assert triggers to a change from the same commit in blockchain.cpp line 838:

    ss << VARINT(outputs.begin()->second.nHeight * 2 + outputs.begin()->second.fCoinBase, VarIntMode::NONNEGATIVE_SIGNED);

    Changing the VarIntMode to DEFAULT removes one of the errors. From my inspection the two fields being encoded are both uint's so shouldn't need the NONNEGATIVE_SIGNED mode (of course that may be different with non-msvc compilers):

    outputs.begin()->second.nHeight is uint32_t outputs.begin()->second.fCoinBase is unsigned int

    I'm not really sure what the best approach to fix this is but am happy to do any further investigation if required.

  2. fanquake added the label Windows on Mar 20, 2018
  3. ryanofsky referenced this in commit e491b96ea2 on Mar 20, 2018
  4. ryanofsky cross-referenced this on Mar 20, 2018 from issue Remove unnecessary NONNEGATIVE_SIGNED by ryanofsky
  5. ryanofsky commented at 5:13 PM on March 20, 2018: contributor

    Can you try #12737 which removes the use of NONNEGATIVE_SIGNED here?

    It seems fCoinBase is treated like a signed value on linux but an unsigned value on windows. #12737 makes it unsigned in all cases.

  6. ryanofsky referenced this in commit 34ca750320 on Mar 20, 2018
  7. sipa referenced this in commit 9b8b1079dd on Mar 21, 2018
  8. fanquake commented at 3:01 AM on March 21, 2018: member

    Should be fixed by #12737.

  9. fanquake closed this on Mar 21, 2018

  10. 2a5A1Ghu1 cross-referenced this on Apr 5, 2018 from issue doc: add qrencode to brew install instructions (#1) by 2a5A1Ghu1
  11. HashUnlimited referenced this in commit 4d56dec88c on Jul 31, 2018
  12. HashUnlimited cross-referenced this on Jul 31, 2018 from issue Remove unnecessary NONNEGATIVE_SIGNED by HashUnlimited
  13. lionello referenced this in commit 254b9de779 on Nov 7, 2018
  14. furszy referenced this in commit dc37dd9e07 on Mar 21, 2021
  15. PastaPastaPasta referenced this in commit 032593d047 on Apr 13, 2021
  16. xdustinface referenced this in commit b42032d3a8 on Apr 13, 2021
  17. bitcoin locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-20 06:55 UTC