refactor: [qt] Use SpanReader to avoid two vector copies
What changed, and why it matters
This is a small code cleanup in Bitcoin Core's Qt wallet GUI. It replaces a two-step copy of a string into a byte vector with a direct reader that views the string's bytes without copying. There is no security issue visible in the change.
No security action needed. Treat as a normal performance/refactoring improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit refactors deserialization in RecentRequestsTableModel::addNewRequest(std::string). Previously the code copied the std::string into a std::vector
Changed components
src/qt/recentrequeststablemodel.cppInspect captured patch +1 / −2
diff --git a/src/qt/recentrequeststablemodel.cpp b/src/qt/recentrequeststablemodel.cpp
index d8ef0695..70b628ae 100644
--- a/src/qt/recentrequeststablemodel.cpp
+++ b/src/qt/recentrequeststablemodel.cpp
@@ -189,8 +189,7 @@ void RecentRequestsTableModel::addNewRequest(const SendCoinsRecipient &recipient
// called from ctor when loading from wallet
void RecentRequestsTableModel::addNewRequest(const std::string &recipient)
{
- std::vector<uint8_t> data(recipient.begin(), recipient.end());
- DataStream ss{data};
+ SpanReader ss{MakeByteSpan(recipient)};
RecentRequestEntry entry;
ss >> entry;
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.