Merge bitcoin/bitcoin#34483: refactor: Use SpanReader over DataStream

fa0677d131 refactor: Use SpanReader over DataStream (MarcoFalke)
fad3eb3956 refactor: Use SpanReader over DataStream (MarcoFalke)
fa06e26764 refactor: [qt] Use SpanReader to avoid two vector copies (MarcoFalke)
fabd4d2e2e refactor: Avoid UB in SpanReader::ignore (MarcoFalke)
fa20bc2ec2 refactor: Use empty() over eof() in the streams interface (MarcoFalke)
fa879db735 test: Read debug log for self-checking comment (MarcoFalke)

Pull request description:

  This changes all places, where possible, to use SpanReader over DataStream. This makes the code easier to read and reason about, because `SpanReader` can never write data. Also, the code should be minimally faster, because it avoids a full redundant copy of the whole vector of bytes.

ACKs for top commit:
  stickies-v:
    re-ACK fa0677d131
  achow101:
    ACK fa0677d131
  janb84:
    re ACK fa0677d131
  sipa:
    crACK fa0677d131

Tree-SHA512: 1d9f43fc6e71d481cf7b8f8457f479745ee331734649e9e2c2ab00ce5d317112796c77afc328612ed004e65ac5c16fc92279d760cfb012cfddce9098c4af810f
This commit is contained in:
Ava Chow
2026-02-06 18:00:18 -08:00
30 changed files with 49 additions and 71 deletions

View File

@@ -377,7 +377,7 @@ bool LoadCryptedKey(CWallet* pwallet, DataStream& ssKey, DataStream& ssValue, st
// Get the checksum and check it
bool checksum_valid = false;
if (!ssValue.eof()) {
if (!ssValue.empty()) {
uint256 checksum;
ssValue >> checksum;
if (!(checksum_valid = Hash(vchPrivKey) == checksum)) {