Changeset View
Changeset View
Standalone View
Standalone View
src/script/script.h
Show First 20 Lines • Show All 397 Lines • ▼ Show 20 Lines | static int64_t set_vch(const std::vector<uint8_t> &vch) { | ||||
} | } | ||||
return result; | return result; | ||||
} | } | ||||
int64_t m_value; | int64_t m_value; | ||||
}; | }; | ||||
/** | |||||
* We use a prevector for the script to reduce the considerable memory overhead | |||||
* of vectors in cases where they normally contain a small number of small | |||||
* elements. Tests in October 2015 showed use of this reduced dbcache memory | |||||
* usage by 23% and made an initial sync 13% faster. | |||||
*/ | |||||
typedef prevector<28, uint8_t> CScriptBase; | typedef prevector<28, uint8_t> CScriptBase; | ||||
/** Serialized script, used inside transaction inputs and outputs */ | /** Serialized script, used inside transaction inputs and outputs */ | ||||
class CScript : public CScriptBase { | class CScript : public CScriptBase { | ||||
protected: | protected: | ||||
CScript &push_int64(int64_t n) { | CScript &push_int64(int64_t n) { | ||||
if (n == -1 || (n >= 1 && n <= 16)) { | if (n == -1 || (n >= 1 && n <= 16)) { | ||||
push_back(n + (OP_1 - 1)); | push_back(n + (OP_1 - 1)); | ||||
▲ Show 20 Lines • Show All 259 Lines • Show Last 20 Lines |