MCPcopy Create free account
hub / github.com/Bitcoin-ABC/bitcoin-abc / getSubVersionEB

Function getSubVersionEB

src/net.cpp:3242–3254  ·  view source on GitHub ↗

* This function convert MaxBlockSize from byte to * MB with a decimal precision one digit rounded down * E.g. * 1660000 -> 1.6 * 2010000 -> 2.0 * 1000000 -> 1.0 * 230000 -> 0.2 * 50000 -> 0.0 * * NB behavior for EB<1MB not standardized yet still * the function applies the same algo used for * EB greater or equal to 1MB */

Source from the content-addressed store, hash-verified

3240 * EB greater or equal to 1MB
3241 */
3242std::string getSubVersionEB(uint64_t MaxBlockSize) {
3243 // Prepare EB string we are going to add to SubVer:
3244 // 1) translate from byte to MB and convert to string
3245 // 2) limit the EB string to the first decimal digit (floored)
3246 std::stringstream ebMBs;
3247 ebMBs << (MaxBlockSize / (ONE_MEGABYTE / 10));
3248 std::string eb = ebMBs.str();
3249 eb.insert(eb.size() - 1, ".", 1);
3250 if (eb.substr(0, 1) == ".") {
3251 eb = "0" + eb;
3252 }
3253 return eb;
3254}
3255
3256std::string userAgent(const Config &config) {
3257 // format excessive blocksize value

Callers 3

userAgentFunction · 0.85
BOOST_AUTO_TEST_CASEFunction · 0.85
getExcessiveBlockSizeSigFunction · 0.85

Calls 3

strMethod · 0.80
insertMethod · 0.45
sizeMethod · 0.45

Tested by 2

BOOST_AUTO_TEST_CASEFunction · 0.68
getExcessiveBlockSizeSigFunction · 0.68