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

Method IsPegoutScript

src/script/script.cpp:248–278  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

246// ELEMENTS:
247
248bool CScript::IsPegoutScript(uint256& genesis_hash, CScript& pegout_scriptpubkey) const
249{
250 const_iterator pc = begin();
251 std::vector<unsigned char> data;
252 opcodetype opcode;
253
254 // OP_RETURN
255 if (!GetOp(pc, opcode, data) || opcode != OP_RETURN) {
256 return false;
257 }
258
259 if (!GetOp(pc, opcode, data) || data.size() != 32 || opcode > OP_PUSHDATA4) {
260 return false;
261 }
262 genesis_hash = uint256(data);
263
264 // Read in parent chain destination scriptpubkey
265 if (!GetOp(pc, opcode, data) || opcode > OP_PUSHDATA4 ) {
266 return false;
267 }
268 pegout_scriptpubkey = CScript(data.begin(), data.end());
269
270 // All extra opcodes must be pushes
271 while(GetOp(pc, opcode, data)) {
272 if (opcode > OP_PUSHDATA4) {
273 return false;
274 }
275 }
276
277 return true;
278}
279
280bool CScript::IsPegoutScript(const uint256& genesis_hash_check) const
281{

Callers 5

ScriptPubKeyToUnivFunction · 0.80
IsStandardFunction · 0.80
sendtomainchain_pakFunction · 0.80
ScriptHasValidPAKProofFunction · 0.80
IsPAKValidOutputFunction · 0.80

Calls 6

beginFunction · 0.85
uint256Class · 0.70
CScriptClass · 0.70
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected