Changeset View
Changeset View
Standalone View
Standalone View
src/script/script.h
Show First 20 Lines • Show All 470 Lines • ▼ Show 20 Lines | public: | ||||
CScript &operator<<(const std::vector<uint8_t> &b) { | CScript &operator<<(const std::vector<uint8_t> &b) { | ||||
if (b.size() < OP_PUSHDATA1) { | if (b.size() < OP_PUSHDATA1) { | ||||
insert(end(), uint8_t(b.size())); | insert(end(), uint8_t(b.size())); | ||||
} else if (b.size() <= 0xff) { | } else if (b.size() <= 0xff) { | ||||
insert(end(), OP_PUSHDATA1); | insert(end(), OP_PUSHDATA1); | ||||
insert(end(), uint8_t(b.size())); | insert(end(), uint8_t(b.size())); | ||||
} else if (b.size() <= 0xffff) { | } else if (b.size() <= 0xffff) { | ||||
insert(end(), OP_PUSHDATA2); | insert(end(), OP_PUSHDATA2); | ||||
uint8_t data[2]; | uint8_t _data[2]; | ||||
WriteLE16(data, b.size()); | WriteLE16(_data, b.size()); | ||||
insert(end(), data, data + sizeof(data)); | insert(end(), _data, _data + sizeof(_data)); | ||||
} else { | } else { | ||||
insert(end(), OP_PUSHDATA4); | insert(end(), OP_PUSHDATA4); | ||||
uint8_t data[4]; | uint8_t _data[4]; | ||||
WriteLE32(data, b.size()); | WriteLE32(_data, b.size()); | ||||
insert(end(), data, data + sizeof(data)); | insert(end(), _data, _data + sizeof(_data)); | ||||
} | } | ||||
insert(end(), b.begin(), b.end()); | insert(end(), b.begin(), b.end()); | ||||
return *this; | return *this; | ||||
} | } | ||||
CScript &operator<<(const CScript &b) { | CScript &operator<<(const CScript &b) { | ||||
// I'm not sure if this should push the script or concatenate scripts. | // I'm not sure if this should push the script or concatenate scripts. | ||||
// If there's ever a use for pushing a script onto a script, delete this | // If there's ever a use for pushing a script onto a script, delete this | ||||
▲ Show 20 Lines • Show All 176 Lines • Show Last 20 Lines |