6 #ifndef FABCOIN_COMPRESSOR_H 7 #define FABCOIN_COMPRESSOR_H 52 bool Compress(std::vector<unsigned char> &out)
const;
54 bool Decompress(
unsigned int nSize,
const std::vector<unsigned char> &out);
58 template<
typename Stream>
60 std::vector<unsigned char> compr;
70 template<
typename Stream>
72 unsigned int nSize = 0;
74 if (nSize < nSpecialScripts) {
81 if (nSize > MAX_SCRIPT_SIZE) {
99 static uint64_t CompressAmount(uint64_t nAmount);
100 static uint64_t DecompressAmount(uint64_t nAmount);
106 template <
typename Stream,
typename Operation>
108 if (!ser_action.ForRead()) {
109 uint64_t nVal = CompressAmount(txout.
nValue);
114 txout.
nValue = DecompressAmount(nVal);
121 #endif // FABCOIN_COMPRESSOR_H
bool IsToKeyID(CKeyID &hash) const
These check for scripts for which a special case with a shorter encoding is defined.
void resize(size_type new_size)
bool Compress(std::vector< unsigned char > &out) const
wrapper for CTxOut that provides a more compact serialization
unsigned int GetSpecialSize(unsigned int nSize) const
bool IsToPubKey(CPubKey &pubkey) const
Compact serializer for scripts.
CTxOutCompressor(CTxOut &txoutIn)
CScriptCompressor(CScript &scriptIn)
bool IsToScriptID(CScriptID &hash) const
void Serialize(Stream &s) const
An encapsulated public key.
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)
Wrapper for serializing arrays and POD.