diff --git a/e2e/e2etests/test_crosschain_swap.go b/e2e/e2etests/test_crosschain_swap.go index 4df1ac129c..1b23d11993 100644 --- a/e2e/e2etests/test_crosschain_swap.go +++ b/e2e/e2etests/test_crosschain_swap.go @@ -137,10 +137,7 @@ func TestCrosschainSwap(r *runner.E2ERunner, _ []string) { r.Logger.Info("cctx2 outbound tx hash %s", cctx2.GetCurrentOutboundParam().Hash) r.Logger.Info("******* Second test: BTC -> ERC20ZRC20") - utxos, err := r.BtcRPCClient.ListUnspent() - if err != nil { - panic(err) - } + utxos := r.ListDeployerUTXOs() r.Logger.Print(fmt.Sprintf("There are %d utxos before SendToTSSFromDeployerWithMemo", len(utxos))) r.Logger.Info("#utxos %d", len(utxos)) r.Logger.Info("memo address %s", r.ERC20ZRC20Addr) diff --git a/e2e/runner/bitcoin.go b/e2e/runner/bitcoin.go index 9d9bfc48cf..62a52a8014 100644 --- a/e2e/runner/bitcoin.go +++ b/e2e/runner/bitcoin.go @@ -29,11 +29,8 @@ import ( var blockHeaderBTCTimeout = 5 * time.Minute -// DepositBTCWithAmount deposits BTC on ZetaChain with a specific amount -func (runner *E2ERunner) DepositBTCWithAmount(amount float64) (txHash *chainhash.Hash) { - runner.Logger.Print("⏳ depositing BTC into ZEVM") - - // fetch utxos +// ListDeployerUTXOs lists the deployer's UTXOs +func (runner *E2ERunner) ListDeployerUTXOs() []btcjson.ListUnspentResult { utxos, err := runner.BtcRPCClient.ListUnspentMinMaxAddresses( 1, 9999999, @@ -42,6 +39,15 @@ func (runner *E2ERunner) DepositBTCWithAmount(amount float64) (txHash *chainhash if err != nil { panic(err) } + return utxos +} + +// DepositBTCWithAmount deposits BTC on ZetaChain with a specific amount +func (runner *E2ERunner) DepositBTCWithAmount(amount float64) (txHash *chainhash.Hash) { + runner.Logger.Print("⏳ depositing BTC into ZEVM") + + // fetch utxos + utxos := runner.ListDeployerUTXOs() spendableAmount := 0.0 spendableUTXOs := 0 @@ -62,7 +68,7 @@ func (runner *E2ERunner) DepositBTCWithAmount(amount float64) (txHash *chainhash runner.Logger.Info("Now sending two txs to TSS address...") amount = amount + zetabitcoin.DefaultDepositorFee - txHash, err = runner.SendToTSSFromDeployerToDeposit( + txHash, err := runner.SendToTSSFromDeployerToDeposit( runner.BTCTSSAddress, amount, utxos, @@ -87,10 +93,7 @@ func (runner *E2ERunner) DepositBTC(testHeader bool) { // fetch utxos btc := runner.BtcRPCClient - utxos, err := runner.BtcRPCClient.ListUnspent() - if err != nil { - panic(err) - } + utxos := runner.ListDeployerUTXOs() spendableAmount := 0.0 spendableUTXOs := 0 for _, utxo := range utxos {