Skip to content

Commit 4401017

Browse files
test: avoid collateral payout reuse in reward reallocation
1 parent 9091989 commit 4401017

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

src/test/block_reward_reallocation_tests.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,13 @@ static void SignTransaction(const CTxMemPool& mempool, CMutableTransaction& tx,
109109
}
110110
}
111111

112+
static CScript GenerateRandomAddress()
113+
{
114+
CKey key;
115+
key.MakeNewKey(false);
116+
return GetScriptForDestination(PKHash(key.GetPubKey()));
117+
}
118+
112119
static CMutableTransaction CreateProRegTx(const CChain& active_chain, const CTxMemPool& mempool, SimpleUTXOMap& utxos, int port, const CScript& scriptPayout, const CKey& coinbaseKey, CKey& ownerKeyRet, CBLSSecretKey& operatorKeyRet)
113120
{
114121
ownerKeyRet.MakeNewKey(true);
@@ -128,21 +135,14 @@ static CMutableTransaction CreateProRegTx(const CChain& active_chain, const CTxM
128135
CMutableTransaction tx;
129136
tx.nVersion = 3;
130137
tx.nType = TRANSACTION_PROVIDER_REGISTER;
131-
FundTransaction(active_chain, tx, utxos, scriptPayout, dmn_types::Regular.collat_amount);
138+
FundTransaction(active_chain, tx, utxos, GenerateRandomAddress(), dmn_types::Regular.collat_amount);
132139
proTx.inputsHash = CalcTxInputsHash(CTransaction(tx));
133140
SetTxPayload(tx, proTx);
134141
SignTransaction(mempool, tx, coinbaseKey);
135142

136143
return tx;
137144
}
138145

139-
static CScript GenerateRandomAddress()
140-
{
141-
CKey key;
142-
key.MakeNewKey(false);
143-
return GetScriptForDestination(PKHash(key.GetPubKey()));
144-
}
145-
146146
BOOST_AUTO_TEST_SUITE(block_reward_reallocation_tests)
147147

148148
BOOST_FIXTURE_TEST_CASE(block_reward_reallocation, TestChainBRRBeforeActivationSetup)

0 commit comments

Comments
 (0)