MCPcopy Create free account
hub / github.com/ElementsProject/elements / Unser

Method Unser

src/compressor.h:77–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75
76 template<typename Stream>
77 void Unser(Stream &s, CScript& script) {
78 unsigned int nSize = 0;
79 s >> VARINT(nSize);
80 if (nSize < nSpecialScripts) {
81 CompressedScript vch(GetSpecialScriptSize(nSize), 0x00);
82 s >> Span{vch};
83 DecompressScript(script, nSize, vch);
84 return;
85 }
86 nSize -= nSpecialScripts;
87 if (nSize > MAX_SCRIPT_SIZE) {
88 // Overly long script, replace with a short invalid one
89 script << OP_RETURN;
90 s.ignore(nSize);
91 } else {
92 script.resize(nSize);
93 s >> Span{script};
94 }
95 }
96};
97
98struct AmountCompression

Callers

nothing calls this directly

Calls 4

GetSpecialScriptSizeFunction · 0.85
DecompressScriptFunction · 0.85
ignoreMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected