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

libbitcoin / libbitcoin-system / 24331809217

13 Apr 2026 07:45AM UTC coverage: 75.852% (-5.8%) from 81.681%
24331809217

push

github

web-flow
Merge pull request #1811 from pmienk/installer-rewrite

Rewritten build/install scripts.

16733 of 22060 relevant lines covered (75.85%)

2499729.97 hits per line

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

81.54
/src/chain/outpoint.cpp
1
/**
2
 * Copyright (c) 2011-2026 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/chain/outpoint.hpp>
20

21
#include <utility>
22
#include <bitcoin/system/chain/point.hpp>
23
#include <bitcoin/system/define.hpp>
24
#include <bitcoin/system/stream/stream.hpp>
25

26
namespace libbitcoin {
27
namespace system {
28
namespace chain {
29

30
// Constructors.
31
// ----------------------------------------------------------------------------
32

33
// Invalid default used in signature hashing.
34
outpoint::outpoint() NOEXCEPT
4✔
35
  : outpoint({}, zero, false)
4✔
36
{
37
}
4✔
38

39
outpoint::outpoint(chain::point&& point, uint64_t value) NOEXCEPT
4✔
40
  : outpoint(std::move(point), value, true)
4✔
41
{
42
}
4✔
43

44
outpoint::outpoint(const chain::point& point, uint64_t value) NOEXCEPT
×
45
  : outpoint(point, value, true)
×
46
{
47
}
×
48

49
outpoint::outpoint(const data_slice& data) NOEXCEPT
1✔
50
  : outpoint(stream::in::fast(data))
1✔
51
{
52
}
1✔
53

54
// protected
55
outpoint::outpoint(stream::in::fast&& stream) NOEXCEPT
1✔
56
  : outpoint(read::bytes::fast(stream))
1✔
57
{
58
}
1✔
59

60
outpoint::outpoint(stream::in::fast& stream) NOEXCEPT
×
61
  : outpoint(read::bytes::fast(stream))
×
62
{
63
}
×
64
outpoint::outpoint(std::istream& stream) NOEXCEPT
2✔
65
  : outpoint(read::bytes::istream(stream))
2✔
66
{
67
}
2✔
68

69
// protected
70
outpoint::outpoint(reader&& source) NOEXCEPT
3✔
71
  : outpoint(source)
3✔
72
{
73
}
3✔
74

75
// outpoint is not part of block, so doesn't use custom allocator.
76
outpoint::outpoint(reader& source) NOEXCEPT
3✔
77
  : point_{ source },
3✔
78
    value_{ source.read_8_bytes_little_endian() },
3✔
79
    valid_{ source }
6✔
80
{
81
}
3✔
82

83
// protected
84
outpoint::outpoint(chain::point&& point, uint64_t value, bool valid) NOEXCEPT
8✔
85
  : point_(std::move(point)), value_(value), valid_(valid)
8✔
86
{
87
}
8✔
88

89
// protected
90
outpoint::outpoint(const chain::point& point, uint64_t value,
×
91
    bool valid) NOEXCEPT
×
92
  : point_(point), value_(value), valid_(valid)
×
93
{
94
}
×
95

96
// Operators.
97
// ----------------------------------------------------------------------------
98
// Value does not contribute to identity.
99

100
bool outpoint::operator==(const outpoint& other) const NOEXCEPT
11✔
101
{
102
    return point() == other.point();
11✔
103
}
104

105
bool outpoint::operator!=(const outpoint& other) const NOEXCEPT
2✔
106
{
107
    return !(*this == other);
2✔
108
}
109

110
bool operator<(const outpoint& left, const outpoint& right) NOEXCEPT
×
111
{
112
    return left.point() < right.point();
×
113
}
114

115
// Serialization.
116
// ----------------------------------------------------------------------------
117

118
data_chunk outpoint::to_data() const NOEXCEPT
1✔
119
{
120
    data_chunk data(serialized_size());
1✔
121
    stream::out::fast ostream(data);
1✔
122
    write::bytes::fast out(ostream);
1✔
123
    to_data(out);
1✔
124
    return data;
2✔
125
}
1✔
126

127
void outpoint::to_data(std::ostream& stream) const NOEXCEPT
1✔
128
{
129
    write::bytes::ostream out(stream);
1✔
130
    to_data(out);
1✔
131
}
1✔
132

133
void outpoint::to_data(writer& sink) const NOEXCEPT
3✔
134
{
135
    point_.to_data(sink);
3✔
136
    sink.write_8_bytes_little_endian(value_);
3✔
137
}
3✔
138

139
// Properties.
140
// ----------------------------------------------------------------------------
141

142
bool outpoint::is_valid() const NOEXCEPT
7✔
143
{
144
    return valid_;
7✔
145
}
146

147
const chain::point& outpoint::point() const NOEXCEPT
28✔
148
{
149
    return point_;
28✔
150
}
151

152
uint64_t outpoint::value() const NOEXCEPT
4✔
153
{
154
    return value_;
4✔
155
}
156

157
// Validation.
158
// ----------------------------------------------------------------------------
159

160
bool outpoint::is_null() const NOEXCEPT
2✔
161
{
162
    return point_.is_null();
2✔
163
}
164

165
} // namespace chain
166
} // namespace system
167
} // 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