mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-07 22:28:02 +02:00
refactor: Use SpanReader over DataStream
This refactor does not change behavior. However, it avoids a vector copy, which can lead to a minimal speed-up of 1%-5%, depending on the call-site. This is mostly relevant for the fuzz tests and utils that read large blobs of data (like a full block).
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
static DataStream& operator>>(DataStream& ds, script_verify_flags& f)
|
||||
static SpanReader& operator>>(SpanReader& ds, script_verify_flags& f)
|
||||
{
|
||||
script_verify_flags::value_type n{0};
|
||||
ds >> n;
|
||||
@@ -27,7 +27,7 @@ static DataStream& operator>>(DataStream& ds, script_verify_flags& f)
|
||||
FUZZ_TARGET(script_flags)
|
||||
{
|
||||
if (buffer.size() > 100'000) return;
|
||||
DataStream ds{buffer};
|
||||
SpanReader ds{buffer};
|
||||
try {
|
||||
const CTransaction tx(deserialize, TX_WITH_WITNESS, ds);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user