mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-04 12:42:05 +02:00
Bug fix: CDataStream::GetAndClear() when nReadPos > 0
Changed CDataStream::GetAndClear() to use the most obvious get get and clear instead of a tricky swap(). Added a unit test for CDataStream insert/erase/GetAndClear. Note: GetAndClear() is not performance critical, it is used only by the send-a-message-to-the-network code. Bug was not noticed before now because the send-a-message code never erased from the stream.
This commit is contained in:
@ -1104,8 +1104,8 @@ public:
|
||||
}
|
||||
|
||||
void GetAndClear(CSerializeData &data) {
|
||||
vch.swap(data);
|
||||
CSerializeData().swap(vch);
|
||||
data.insert(data.end(), begin(), end());
|
||||
clear();
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user