7 #ifndef RAVEN_COMPRESSOR_H 8 #define RAVEN_COMPRESSOR_H 53 bool Compress(std::vector<unsigned char> &out)
const;
55 bool Decompress(
unsigned int nSize,
const std::vector<unsigned char> &out);
59 template<
typename Stream>
61 std::vector<unsigned char> compr;
71 template<
typename Stream>
73 unsigned int nSize = 0;
75 if (nSize < nSpecialScripts) {
82 if (nSize > MAX_SCRIPT_SIZE) {
100 static uint64_t CompressAmount(uint64_t nAmount);
101 static uint64_t DecompressAmount(uint64_t nAmount);
107 template <
typename Stream,
typename Operation>
109 if (!ser_action.ForRead()) {
110 uint64_t nVal = CompressAmount(txout.
nValue);
115 txout.
nValue = DecompressAmount(nVal);
122 #endif // RAVEN_COMPRESSOR_H
void resize(size_type new_size)
wrapper for CTxOut that provides a more compact serialization
bool IsToPubKey(CPubKey &pubkey) const
Compact serializer for scripts.
CTxOutCompressor(CTxOut &txoutIn)
bool IsToKeyID(CKeyID &hash) const
These check for scripts for which a special case with a shorter encoding is defined.
CScriptCompressor(CScript &scriptIn)
An encapsulated public key.
unsigned int GetSpecialSize(unsigned int nSize) const
An output of a transaction.
static const unsigned int nSpecialScripts
make this static for now (there are only 6 special scripts defined) this can potentially be extended ...
Serialized script, used inside transaction inputs and outputs.
bool Decompress(unsigned int nSize, const std::vector< unsigned char > &out)
A reference to a CKey: the Hash160 of its serialized public key.
A reference to a CScript: the Hash160 of its serialization (see script.h)
void SerializationOp(Stream &s, Operation ser_action)
T & REF(const T &val)
Used to bypass the rule against non-const reference to temporary where it makes sense with wrappers s...
void Unserialize(Stream &s)
bool IsToScriptID(CScriptID &hash) const
bool Compress(std::vector< unsigned char > &out) const
Wrapper for serializing arrays and POD.
void Serialize(Stream &s) const