Skip to content

Commit 0c57840

Browse files
dantudoralex v
authored andcommitted
Adds OP_POOL to scripts (#464)
1 parent 47ac15f commit 0c57840

File tree

4 files changed

+21
-1
lines changed

4 files changed

+21
-1
lines changed

src/script/script.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ const char* GetOpName(opcodetype opcode)
151151

152152
case OP_INVALIDOPCODE : return "OP_INVALIDOPCODE";
153153

154+
case OP_POOL : return "OP_POOL";
155+
154156
// Note:
155157
// The template matching params OP_SMALLDATA/etc are defined in opcodetype enum
156158
// as kind of implementation hack, they are *NOT* real opcodes. If found in real
@@ -305,6 +307,13 @@ bool CScript::IsPaymentRequestVoteNo() const
305307
(*this)[4] == 0x20);
306308
}
307309

310+
bool CScript::IsPool() const
311+
{
312+
return (this->size() == 2 &&
313+
(*this)[0] == OP_RETURN &&
314+
(*this)[1] == OP_POOL);
315+
}
316+
308317
bool CScript::ExtractVote(uint256 &hash, bool &vote) const
309318
{
310319
if(!IsPaymentRequestVoteNo() && !IsPaymentRequestVoteYes() && !IsProposalVoteYes()

src/script/script.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,8 @@ enum opcodetype
188188

189189
OP_COINSTAKE = 0xc6,
190190

191+
OP_POOL = 0xd0,
192+
191193
// template matching params
192194
OP_SMALLDATA = 0xf9,
193195
OP_SMALLINTEGER = 0xfa,
@@ -689,6 +691,7 @@ class CScript : public CScriptBase
689691
bool IsPaymentRequestVote() const;
690692
bool IsPaymentRequestVoteYes() const;
691693
bool IsPaymentRequestVoteNo() const;
694+
bool IsPool() const;
692695
bool ExtractVote(uint256 &hash, bool &vote) const;
693696

694697
/** Called by IsStandardTx and P2SH/BIP62 VerifyScript (which makes it consensus-critical). */

src/script/standard.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const char* GetTxnOutputType(txnouttype t)
4040
case TX_WITNESS_V0_KEYHASH: return "witness_v0_keyhash";
4141
case TX_WITNESS_V0_SCRIPTHASH: return "witness_v0_scripthash";
4242
case TX_COLDSTAKING: return "cold_staking";
43+
case TX_POOL: return "pool_staking";
4344
}
4445
return NULL;
4546
}
@@ -124,6 +125,12 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, vector<vector<unsi
124125
return true;
125126
}
126127

128+
if(scriptPubKey.IsPool())
129+
{
130+
typeRet = TX_POOL;
131+
return true;
132+
}
133+
127134
int witnessversion;
128135
std::vector<unsigned char> witnessprogram;
129136
if (scriptPubKey.IsWitnessProgram(witnessversion, witnessprogram)) {

src/script/standard.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ enum txnouttype
5858
TX_PAYMENTREQUESTYESVOTE,
5959
TX_PROPOSALNOVOTE,
6060
TX_PAYMENTREQUESTNOVOTE,
61-
TX_COLDSTAKING
61+
TX_COLDSTAKING,
62+
TX_POOL
6263
};
6364

6465
class CNoDestination {

0 commit comments

Comments
 (0)