Skip to content

Commit

Permalink
Using random seed for newAccountWithSeed
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy-then committed Dec 11, 2024
1 parent ff6d059 commit 24d5f1b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/tests/2wp.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ const execute = (description, getRskHost) => {
const senderRecipientInfo = await createSenderRecipientInfo(rskTxHelper, btcTxHelper);
const initialSenderAddressBalanceInSatoshis = await getBtcAddressBalanceInSatoshis(btcTxHelper, senderRecipientInfo.btcSenderAddressInfo.address);
const peginValueInSatoshis = minimumPeginValueInSatoshis;
const peginV1RskRecipientAddress = await rskTxHelper.newAccountWithSeed('successfulPeginV1');
const peginV1RskRecipientAddress = await rskTxHelper.newAccountWithSeed(rskTxHelper.getClient().utils.randomHex(16));

// Act

Expand Down Expand Up @@ -224,7 +224,7 @@ const execute = (description, getRskHost) => {
// The minimum pegin value minus 1 satoshis
const peginValueInSatoshis = minimumPeginValueInSatoshis - 1;

const peginV1RskRecipientAddress = await rskTxHelper.newAccountWithSeed('rejectedPeginV1');
const peginV1RskRecipientAddress = await rskTxHelper.newAccountWithSeed(rskTxHelper.getClient().utils.randomHex(16));

// Act

Expand Down Expand Up @@ -343,7 +343,7 @@ const execute = (description, getRskHost) => {
await btcTxHelper.fundAddress(multisigSenderAddressInfo.address, Number(satoshisToBtc(minimumPeginValueInSatoshis + btcFeeInSatoshis)));
const initialSenderAddressBalanceInSatoshis = await getBtcAddressBalanceInSatoshis(btcTxHelper, multisigSenderAddressInfo.address);
const peginValueInSatoshis = minimumPeginValueInSatoshis;
const peginV1RskRecipientAddress = await rskTxHelper.newAccountWithSeed('successfulPeginV1FromMultisig');
const peginV1RskRecipientAddress = await rskTxHelper.newAccountWithSeed(rskTxHelper.getClient().utils.randomHex(16));

// Act

Expand Down Expand Up @@ -381,7 +381,7 @@ const execute = (description, getRskHost) => {
await btcTxHelper.fundAddress(bech32SenderAddressInfo.address, Number(satoshisToBtc(minimumPeginValueInSatoshis + btcFeeInSatoshis)));
const initialSenderAddressBalanceInSatoshis = await getBtcAddressBalanceInSatoshis(btcTxHelper, bech32SenderAddressInfo.address);
const peginValueInSatoshis = minimumPeginValueInSatoshis;
const peginV1RskRecipientAddress = await rskTxHelper.newAccountWithSeed('successfulPeginV1FromBech32');
const peginV1RskRecipientAddress = await rskTxHelper.newAccountWithSeed(rskTxHelper.getClient().utils.randomHex(16));

// Act

Expand Down Expand Up @@ -417,7 +417,7 @@ const execute = (description, getRskHost) => {
const senderRecipientInfo = await createSenderRecipientInfo(rskTxHelper, btcTxHelper);
const initialSenderAddressBalanceInSatoshis = await getBtcAddressBalanceInSatoshis(btcTxHelper, senderRecipientInfo.btcSenderAddressInfo.address);
const peginValueInSatoshis = minimumPeginValueInSatoshis;
const peginV1RskRecipientAddress = await rskTxHelper.newAccountWithSeed('successfulPeginV1WithBtcRefundAddress');
const peginV1RskRecipientAddress = await rskTxHelper.newAccountWithSeed(rskTxHelper.getClient().utils.randomHex(16));

// Act

Expand Down Expand Up @@ -497,7 +497,7 @@ const execute = (description, getRskHost) => {
const initial2wpBalances = await get2wpBalances(rskTxHelper, btcTxHelper);
const peginValueInSatoshis = minimumPeginValueInSatoshis;
const senderRecipientInfo = await createSenderRecipientInfo(rskTxHelper, btcTxHelper, 'p2sh-segwit', Number(satoshisToBtc(peginValueInSatoshis + btcFeeInSatoshis)));
const peginV1RskRecipientAddress = await rskTxHelper.newAccountWithSeed('rejectedPeginWithMultipleOpReturnOutputs');
const peginV1RskRecipientAddress = await rskTxHelper.newAccountWithSeed(rskTxHelper.getClient().utils.randomHex(16));

const data = [];
data.push(Buffer.from(createPeginV1TxData(senderRecipientInfo.rskRecipientRskAddressInfo.address), 'hex'));
Expand Down Expand Up @@ -542,7 +542,7 @@ const execute = (description, getRskHost) => {
const senderRecipientInfo = await createSenderRecipientInfo(rskTxHelper, btcTxHelper);
const initialSenderAddressBalanceInSatoshis = await getBtcAddressBalanceInSatoshis(btcTxHelper, senderRecipientInfo.btcSenderAddressInfo.address);
const peginValueInSatoshis = minimumPeginValueInSatoshis;
const peginV1RskRecipientAddress = await rskTxHelper.newAccountWithSeed('successfulPeginV1Multiple_OP_RETURN');
const peginV1RskRecipientAddress = await rskTxHelper.newAccountWithSeed(rskTxHelper.getClient().utils.randomHex(16));

// Act

Expand Down Expand Up @@ -626,7 +626,7 @@ const execute = (description, getRskHost) => {
const initial2wpBalances = await get2wpBalances(rskTxHelper, btcTxHelper);
const peginValueInSatoshis = minimumPeginValueInSatoshis;
const senderRecipientInfo = await createSenderRecipientInfo(rskTxHelper, btcTxHelper, 'p2sh-segwit', Number(satoshisToBtc(peginValueInSatoshis + btcFeeInSatoshis)));
const peginV1RskRecipientAddress = await rskTxHelper.newAccountWithSeed('successfulPeginV1InvalidVersion');
const peginV1RskRecipientAddress = await rskTxHelper.newAccountWithSeed(rskTxHelper.getClient().utils.randomHex(16));

const invalidPeginV1Version = '999';
const peginV1InvalidPayload = `${PEGIN_V1_RSKT_PREFIX_HEX}${invalidPeginV1Version}${removePrefix0x(peginV1RskRecipientAddress)}`;
Expand Down

0 comments on commit 24d5f1b

Please sign in to comment.