Skip to content

Commit ceeaf31

Browse files
committed
[Tests] Add Get/Set payload unit-test for ProUpReg txes
1 parent 1f9e61c commit ceeaf31

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/test/evo_specialtx_tests.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,18 @@ static ProUpServPL GetRandomProUpServPayload()
5858
return pl;
5959
}
6060

61+
static ProUpRegPL GetRandomProUpRegPayload()
62+
{
63+
ProUpRegPL pl;
64+
pl.proTxHash = GetRandHash();
65+
pl.keyIDOperator = GetRandomKeyID();
66+
pl.keyIDVoting = GetRandomKeyID();
67+
pl.scriptPayout = GetRandomScript();
68+
pl.inputsHash = GetRandHash();
69+
pl.vchSig = InsecureRandBytes(63);
70+
return pl;
71+
}
72+
6173
BOOST_AUTO_TEST_CASE(protx_validation_test)
6274
{
6375
CMutableTransaction mtx;
@@ -146,6 +158,22 @@ BOOST_AUTO_TEST_CASE(proupserv_setpayload_test)
146158
BOOST_CHECK(pl.vchSig == pl2.vchSig);
147159
}
148160

161+
BOOST_AUTO_TEST_CASE(proupreg_setpayload_test)
162+
{
163+
const ProUpRegPL& pl = GetRandomProUpRegPayload();
164+
165+
CMutableTransaction mtx;
166+
SetTxPayload(mtx, pl);
167+
ProUpRegPL pl2;
168+
BOOST_CHECK(GetTxPayload(mtx, pl2));
169+
BOOST_CHECK(pl.proTxHash == pl2.proTxHash);
170+
BOOST_CHECK(pl.keyIDOperator == pl2.keyIDOperator);
171+
BOOST_CHECK(pl.keyIDVoting == pl2.keyIDVoting);
172+
BOOST_CHECK(pl.scriptPayout == pl2.scriptPayout);
173+
BOOST_CHECK(pl.inputsHash == pl2.inputsHash);
174+
BOOST_CHECK(pl.vchSig == pl2.vchSig);
175+
}
176+
149177
BOOST_AUTO_TEST_CASE(proreg_checkstringsig_test)
150178
{
151179
ProRegPL pl = GetRandomProRegPayload();

0 commit comments

Comments
 (0)