Skip to content

Commit 974bb5e

Browse files
committed
[BDAP] Add get bdap operation codes to CTxOut class
1 parent 3fd88c5 commit 974bb5e

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/primitives/transaction.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,28 @@ bool CTxOut::IsBDAP() const
7474
return false;
7575
}
7676

77+
void CTxOut::GetBDAPOpCodes(int& opCode1, int& opCode2) const
78+
{
79+
if (!IsBDAP())
80+
return;
81+
82+
opcodetype opcode;
83+
CScript::const_iterator pc = scriptPubKey.begin();
84+
if (!scriptPubKey.GetOp(pc, opcode))
85+
return;
86+
if (opcode < OP_1 || opcode > OP_16)
87+
return;
88+
89+
opCode1 = CScript::DecodeOP_N(opcode);
90+
91+
if (!scriptPubKey.GetOp(pc, opcode))
92+
return;
93+
if (opcode < OP_1 || opcode > OP_16)
94+
return;
95+
96+
opCode2 = CScript::DecodeOP_N(opcode);
97+
}
98+
7799
bool CTxOut::IsData() const
78100
{
79101
opcodetype opcode;

src/primitives/transaction.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ class CTxOut
220220

221221
bool IsBDAP() const;
222222
bool IsData() const;
223+
void GetBDAPOpCodes(int& opCode1, int& opCode2) const;
223224

224225
std::string ToString() const;
225226
};

0 commit comments

Comments
 (0)