Changeset View
Changeset View
Standalone View
Standalone View
src/script/sign.h
Show First 20 Lines • Show All 158 Lines • ▼ Show 20 Lines | |||||
static constexpr uint8_t PSBT_SEPARATOR = 0x00; | static constexpr uint8_t PSBT_SEPARATOR = 0x00; | ||||
// Takes a stream and multiple arguments and serializes them as if first | // Takes a stream and multiple arguments and serializes them as if first | ||||
// serialized into a vector and then into the stream. The resulting output into | // serialized into a vector and then into the stream. The resulting output into | ||||
// the stream has the total serialized length of all of the objects followed by | // the stream has the total serialized length of all of the objects followed by | ||||
// all objects concatenated with each other. | // all objects concatenated with each other. | ||||
template <typename Stream, typename... X> | template <typename Stream, typename... X> | ||||
void SerializeToVector(Stream &s, const X &... args) { | void SerializeToVector(Stream &s, const X &... args) { | ||||
WriteCompactSize(s, GetSerializeSizeMany(s, args...)); | WriteCompactSize(s, GetSerializeSizeMany(s.GetVersion(), args...)); | ||||
SerializeMany(s, args...); | SerializeMany(s, args...); | ||||
} | } | ||||
// Takes a stream and multiple arguments and unserializes them first as a vector | // Takes a stream and multiple arguments and unserializes them first as a vector | ||||
// then each object individually in the order provided in the arguments. | // then each object individually in the order provided in the arguments. | ||||
template <typename Stream, typename... X> | template <typename Stream, typename... X> | ||||
void UnserializeFromVector(Stream &s, X &... args) { | void UnserializeFromVector(Stream &s, X &... args) { | ||||
size_t expected_size = ReadCompactSize(s); | size_t expected_size = ReadCompactSize(s); | ||||
▲ Show 20 Lines • Show All 526 Lines • Show Last 20 Lines |