mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
Remove unused (and broken) functionality in SpanReader
This removes the ability to set an offset in the SpanReader constructor,
as the current code is broken. All call sites use pos=0, so it is actually
unused. If future call sites need it, SpanReader{a, b, c, d} is equivalent
to SpanReader{a, b, c.subspan(d)}.
It also removes the ability to deserialize from SpanReader directly from
the constructor. This too is unused, and can be more idiomatically
simulated using (SpanReader{a, b, c} >> x >> y >> z) instead of
SpanReader{a, b, c, x, y, z}.
This commit is contained in:
@@ -54,7 +54,7 @@ CMutableTransaction TxFromHex(const std::string& str)
|
||||
{
|
||||
CMutableTransaction tx;
|
||||
try {
|
||||
SpanReader{SER_DISK, SERIALIZE_TRANSACTION_NO_WITNESS, CheckedParseHex(str), 0} >> tx;
|
||||
SpanReader{SER_DISK, SERIALIZE_TRANSACTION_NO_WITNESS, CheckedParseHex(str)} >> tx;
|
||||
} catch (const std::ios_base::failure&) {
|
||||
throw std::runtime_error("Tx deserialization failure");
|
||||
}
|
||||
@@ -68,7 +68,7 @@ std::vector<CTxOut> TxOutsFromJSON(const UniValue& univalue)
|
||||
for (size_t i = 0; i < univalue.size(); ++i) {
|
||||
CTxOut txout;
|
||||
try {
|
||||
SpanReader{SER_DISK, 0, CheckedParseHex(univalue[i].get_str()), 0} >> txout;
|
||||
SpanReader{SER_DISK, 0, CheckedParseHex(univalue[i].get_str())} >> txout;
|
||||
} catch (const std::ios_base::failure&) {
|
||||
throw std::runtime_error("Prevout invalid format");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user