MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / AppendDataSize

Method AppendDataSize

src/script/script.h:408–426  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

406{
407private:
408 inline void AppendDataSize(const uint32_t size)
409 {
410 if (size < OP_PUSHDATA1) {
411 insert(end(), static_cast<value_type>(size));
412 } else if (size <= 0xff) {
413 insert(end(), OP_PUSHDATA1);
414 insert(end(), static_cast<value_type>(size));
415 } else if (size <= 0xffff) {
416 insert(end(), OP_PUSHDATA2);
417 value_type data[2];
418 WriteLE16(data, size);
419 insert(end(), std::cbegin(data), std::cend(data));
420 } else {
421 insert(end(), OP_PUSHDATA4);
422 value_type data[4];
423 WriteLE32(data, size);
424 insert(end(), std::cbegin(data), std::cend(data));
425 }
426 }
427
428 void AppendData(std::span<const value_type> data)
429 {

Callers

nothing calls this directly

Calls 4

insertFunction · 0.85
endFunction · 0.85
WriteLE16Function · 0.85
WriteLE32Function · 0.85

Tested by

no test coverage detected