diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2018-04-04 12:40:10 -0700 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2018-04-05 08:20:37 -0700 |
commit | 9272d70536287d4ff9aa1ee41a401465c0e8194a (patch) | |
tree | 04ba75bd2a66ecec47a47e4e1883f07ac07775e0 /src/compressor.h | |
parent | 833bc085835dd1bcd8c0fc2a25aa746b7d6fe012 (diff) |
Support serializing Span<unsigned char> and use that instead of FLATDATA
Diffstat (limited to 'src/compressor.h')
-rw-r--r-- | src/compressor.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/compressor.h b/src/compressor.h index 561c8e66d0..6bd68529d4 100644 --- a/src/compressor.h +++ b/src/compressor.h @@ -9,6 +9,7 @@ #include <primitives/transaction.h> #include <script/script.h> #include <serialize.h> +#include <span.h> class CKeyID; class CPubKey; @@ -51,12 +52,12 @@ public: void Serialize(Stream &s) const { std::vector<unsigned char> compr; if (CompressScript(script, compr)) { - s << CFlatData(compr); + s << MakeSpan(compr); return; } unsigned int nSize = script.size() + nSpecialScripts; s << VARINT(nSize); - s << CFlatData(script); + s << MakeSpan(script); } template<typename Stream> @@ -65,7 +66,7 @@ public: s >> VARINT(nSize); if (nSize < nSpecialScripts) { std::vector<unsigned char> vch(GetSpecialScriptSize(nSize), 0x00); - s >> CFlatData(vch); + s >> MakeSpan(vch); DecompressScript(script, nSize, vch); return; } @@ -76,7 +77,7 @@ public: s.ignore(nSize); } else { script.resize(nSize); - s >> CFlatData(script); + s >> MakeSpan(script); } } }; |