• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

libbitcoin / libbitcoin-system / 8058765677

27 Feb 2024 02:29AM UTC coverage: 82.634% (+0.005%) from 82.629%
8058765677

Pull #1411

github

web-flow
Merge 2399024ce into e8296511c
Pull Request #1411: Add settings, checkpoint.equals, uint256_t serialize, chain_state.cumulative_work.

11 of 22 new or added lines in 4 files covered. (50.0%)

3 existing lines in 2 files now uncovered.

9636 of 11661 relevant lines covered (82.63%)

4891762.23 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

33.33
/src/config/hash256.cpp
1
/**
2
 * Copyright (c) 2011-2023 libbitcoin developers (see AUTHORS)
3
 *
4
 * This file is part of libbitcoin.
5
 *
6
 * This program is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU Affero General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU Affero General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Affero General Public License
17
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
 */
19
#include <bitcoin/system/config/hash256.hpp>
20

21
#include <iostream>
22
#include <sstream>
23
#include <string>
24
#include <utility>
25
#include <bitcoin/system/hash/hash.hpp>
26
#include <bitcoin/system/radix/radix.hpp>
27

28
namespace libbitcoin {
29
namespace system {
30
namespace config {
31

32
hash256::hash256() NOEXCEPT
38✔
33
  : value_(null_hash)
38✔
34
{
35
}
38✔
36

37
hash256::hash256(hash_digest&& value) NOEXCEPT
34✔
38
  : value_(std::move(value))
34✔
39
{
40
}
34✔
41

42
hash256::hash256(const hash_digest& value) NOEXCEPT
×
43
  : value_(value)
×
44
{
45
}
×
46

47
hash256::hash256(const std::string& base16) THROWS
×
48
{
49
    std::istringstream(base16) >> *this;
×
50
}
×
51

52
std::string hash256::to_string() const NOEXCEPT
×
53
{
54
    std::ostringstream value;
×
55
    value << *this;
×
56
    return value.str();
×
57
}
×
58

59
hash256::operator const hash_digest&() const NOEXCEPT
1✔
60
{
61
    return value_;
1✔
62
}
63

64
hash256::operator uint256_t() const NOEXCEPT
3✔
65
{
66
    return to_uintx(value_);
3✔
67
}
68

UNCOV
69
std::istream& operator>>(std::istream& stream, hash256& argument) THROWS
×
70
{
71
    std::string base16;
×
72
    stream >> base16;
×
73

74
    if (!decode_hash(argument.value_, base16))
×
75
        throw istream_exception(base16);
×
76

77
    return stream;
×
78
}
79

80
std::ostream& operator<<(std::ostream& stream, const hash256& argument) NOEXCEPT
×
81
{
82
    stream << encode_hash(argument.value_);
×
83
    return stream;
×
84
}
85

86
} // namespace config
87
} // namespace system
88
} // namespace libbitcoin
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc