mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-16 13:01:19 +02:00
All peg-out related detection pushes should be <= OP_PUSHDATA4
This commit is contained in:
parent
bb80fd1602
commit
cff50f5c36
2 changed files with 10 additions and 3 deletions
|
|
@ -185,7 +185,7 @@ bool ScriptHasValidPAKProof(const CScript& script, const uint256& genesis_hash)
|
||||||
std::vector<unsigned char> extracted_pubkey_hash;
|
std::vector<unsigned char> extracted_pubkey_hash;
|
||||||
|
|
||||||
// Get full pubkey
|
// Get full pubkey
|
||||||
if (!script.GetOp(pc, opcode, data) || opcode != 33 || data.size() != 33) {
|
if (!script.GetOp(pc, opcode, data) || data.size() != 33 || opcode > OP_PUSHDATA4) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
CPubKey full_pubkey(data.begin(), data.end());
|
CPubKey full_pubkey(data.begin(), data.end());
|
||||||
|
|
|
||||||
|
|
@ -213,17 +213,24 @@ bool CScript::IsPegoutScript(uint256& genesis_hash, CScript& pegout_scriptpubkey
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GetOp(pc, opcode, data) || data.size() != 32 ) {
|
if (!GetOp(pc, opcode, data) || data.size() != 32 || opcode > OP_PUSHDATA4) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
genesis_hash = uint256(data);
|
genesis_hash = uint256(data);
|
||||||
|
|
||||||
// Read in parent chain destination scriptpubkey
|
// Read in parent chain destination scriptpubkey
|
||||||
if (!GetOp(pc, opcode, data) || data.size() == 0 ) {
|
if (!GetOp(pc, opcode, data) || opcode > OP_PUSHDATA4 ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
pegout_scriptpubkey = CScript(data.begin(), data.end());
|
pegout_scriptpubkey = CScript(data.begin(), data.end());
|
||||||
|
|
||||||
|
// All extra opcodes must be pushes
|
||||||
|
while(GetOp(pc, opcode, data)) {
|
||||||
|
if (opcode > OP_PUSHDATA4) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue