Skip to content

Commit

Permalink
Resetting fee per kb after test.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy-then committed Oct 26, 2024
1 parent a6c381b commit aed2792
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/tests/2wp.js
Original file line number Diff line number Diff line change
Expand Up @@ -792,8 +792,10 @@ const execute = (description, getRskHost) => {
const initialRskSenderBalanceInWeisBN = await rskTxHelper.getBalance(senderRecipientInfo.rskRecipientRskAddressInfo.address);
const pegoutValueInRbtc = MINIMUM_PEGOUT_AMOUNT_IN_RBTC;

// The minimum pegout value plus 1 satoshi to make the fee per kb exactly above the pegout value.
const newFeePerKbInSatoshis = btcToSatoshis(MINIMUM_PEGOUT_AMOUNT_IN_RBTC) + 1;
// We just need to have a feePerKB that will cause the pegout to rejected due to FEE_ABOVE_VALUE reason.
// This value is way bigger than what we need, but actual calculation is complex and and estimation so we cannot know for sure.
// That's we we just use a big enough value. The MINIMUM_PEGOUT_AMOUNT_IN_RBTC is perfect for this in this case.
const newFeePerKbInSatoshis = btcToSatoshis(MINIMUM_PEGOUT_AMOUNT_IN_RBTC);
await setFeePerKb(rskTxHelper, newFeePerKbInSatoshis);

// Act
Expand All @@ -816,6 +818,9 @@ const execute = (description, getRskHost) => {
const finalBtcRecipientBalanceInSatoshis = await getBtcAddressBalanceInSatoshis(btcTxHelper, senderRecipientInfo.btcSenderAddressInfo.address);
expect(finalBtcRecipientBalanceInSatoshis).to.be.equal(initialBtcRecipientAddressBalanceInSatoshis);

// Setting fee per kb back to its original value
await setFeePerKb(rskTxHelper, initialFeePerKb);

});

});
Expand Down

0 comments on commit aed2792

Please sign in to comment.