diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-11-24 11:03:43 +0100 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-11-24 11:04:37 +0100 |
commit | 9394964f6b9d1cf1220a4eca17ba18dc49ae876d (patch) | |
tree | 4d34bd6c992aa8fb2b37aef1bea43c9477cf73c6 /src/pubkey.h | |
parent | 73ac195e29cc3991cb97c6c3dce8d64eaad0e57a (diff) | |
parent | faa3ec2304051be7cfbe301cfbfbda3faf7514fc (diff) |
Merge bitcoin/bitcoin#23451: span: Add std::byte helpers
faa3ec2304051be7cfbe301cfbfbda3faf7514fc span: Add std::byte helpers (MarcoFalke)
fa18038f519db76befb9a7bd0b1540143bfeb12b refactor: Use ignore helper when unserializing an invalid pubkey (MarcoFalke)
fabe18d0b39b4b918bf60e3a313eaa36fb4067f2 Use value_type in CDataStream where possible (MarcoFalke)
Pull request description:
This adds (currently unused) span std::byte helpers, so that they can be used in new code.
The refactors are also required for https://github.com/bitcoin/bitcoin/pull/23438, but they are split up because the other pull doesn't compile with msvc right now.
The third commit is not needed for the other pull, but still nice.
ACKs for top commit:
klementtan:
reACK faa3ec2. Verified that all the new `std::byte` helper functions are tested.
laanwj:
Code review ACK faa3ec2304051be7cfbe301cfbfbda3faf7514fc
Tree-SHA512: b1f6af39f03ea4dfebf20d4a8538fa993a6104e7fc92ddf0c4606a7efc3ca9a8c1a4741d98a1418569c11bb9ce9258bf0c0c06d93d85ed7e208902a2db04e407
Diffstat (limited to 'src/pubkey.h')
-rw-r--r-- | src/pubkey.h | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/pubkey.h b/src/pubkey.h index f174ad8d85..ae6356c246 100644 --- a/src/pubkey.h +++ b/src/pubkey.h @@ -141,7 +141,7 @@ public: template <typename Stream> void Unserialize(Stream& s) { - unsigned int len = ::ReadCompactSize(s); + const unsigned int len(::ReadCompactSize(s)); if (len <= SIZE) { s.read((char*)vch, len); if (len != size()) { @@ -149,9 +149,7 @@ public: } } else { // invalid pubkey, skip available data - char dummy; - while (len--) - s.read(&dummy, 1); + s.ignore(len); Invalidate(); } } |