From f39a4199c2502fd882831379a5656e6f24a46ddd Mon Sep 17 00:00:00 2001 From: jeremy-then Date: Wed, 30 Oct 2024 15:02:11 -0400 Subject: [PATCH] Using sendTxWithCheck for setFeePerKB --- lib/constants.js | 5 +++++ lib/rsk-utils.js | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/constants.js b/lib/constants.js index 15f656bd..6c4e5238 100644 --- a/lib/constants.js +++ b/lib/constants.js @@ -120,6 +120,10 @@ const DEFAULT_RSK_ADDRESS_FUNDING_IN_BTC = 0.5; const FEE_PER_KB_CHANGER_PRIVATE_KEY = '6a4b49312b91e203ddfb9bc2d900ebbd46fbede46a7462e770bedcb11ad405e9'; const FEE_PER_KB_CHANGER_ADDRESS = '53f8f6dabd612b6137215ddd7758bb5cdd638922'; +const FEE_PER_KB_RESPONSE_CODES = { + SUCCESSFUL_VOTE: 1, +}; + module.exports = { KEY_TYPE_BTC, KEY_TYPE_RSK, @@ -148,4 +152,5 @@ module.exports = { PEGOUT_REJECTION_REASONS, FEE_PER_KB_CHANGER_PRIVATE_KEY, FEE_PER_KB_CHANGER_ADDRESS, + FEE_PER_KB_RESPONSE_CODES, }; diff --git a/lib/rsk-utils.js b/lib/rsk-utils.js index bc9102c3..155d77be 100644 --- a/lib/rsk-utils.js +++ b/lib/rsk-utils.js @@ -10,6 +10,7 @@ const { PEGOUT_EVENTS, FEE_PER_KB_CHANGER_PRIVATE_KEY, FEE_PER_KB_CHANGER_ADDRESS, + FEE_PER_KB_RESPONSE_CODES, } = require('./constants'); const BtcTransactionHelper = require('btc-transaction-helper/btc-transaction-helper'); @@ -519,7 +520,9 @@ const setFeePerKb = async (rskTxHelper, feePerKbInSatoshis) => { await rskTxHelper.getClient().eth.personal.unlockAccount(FEE_PER_KB_CHANGER_ADDRESS, ''); const bridge = getBridge(rskTxHelper.getClient()); - await sendTransaction(rskTxHelper, bridge.methods.voteFeePerKbChange(feePerKbInSatoshis), FEE_PER_KB_CHANGER_ADDRESS); + await sendTxWithCheck(rskTxHelper, bridge.methods.voteFeePerKbChange(feePerKbInSatoshis), FEE_PER_KB_CHANGER_ADDRESS, (result) => { + expect(Number(result)).to.equal(FEE_PER_KB_RESPONSE_CODES.SUCCESSFUL_VOTE); + }); const finalFeePerKb = await bridge.methods.getFeePerKb().call(); expect(Number(finalFeePerKb)).to.equal(Number(feePerKbInSatoshis));