mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-12 21:52:38 +01:00
Use spans of std::byte in serialize
This switches .read() and .write() to take spans of bytes.
This commit is contained in:
@@ -142,14 +142,14 @@ public:
|
||||
{
|
||||
unsigned int len = size();
|
||||
::WriteCompactSize(s, len);
|
||||
s.write((char*)vch, len);
|
||||
s.write(AsBytes(Span{vch, len}));
|
||||
}
|
||||
template <typename Stream>
|
||||
void Unserialize(Stream& s)
|
||||
{
|
||||
const unsigned int len(::ReadCompactSize(s));
|
||||
if (len <= SIZE) {
|
||||
s.read((char*)vch, len);
|
||||
s.read(AsWritableBytes(Span{vch, len}));
|
||||
if (len != size()) {
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user