multi: repleace ioutil.ReadFile

This commit is contained in:
erik
2023-06-13 21:22:44 +07:00
committed by ErikEk
parent 619c8f4eb8
commit ab83343c87
23 changed files with 55 additions and 62 deletions

View File

@@ -3,7 +3,6 @@ package itest
import (
"context"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strconv"
@@ -285,7 +284,7 @@ func testChannelBackupRestoreBasic(ht *lntest.HarnessTest) {
// Read the entire Multi backup stored within
// this node's channel.backup file.
multi, err := ioutil.ReadFile(backupFilePath)
multi, err := os.ReadFile(backupFilePath)
require.NoError(st, err)
// Now that we have Dave's backup file, we'll
@@ -376,7 +375,7 @@ func testChannelBackupRestoreBasic(ht *lntest.HarnessTest) {
// Read the entire Multi backup stored within
// this node's channel.backup file.
multi, err := ioutil.ReadFile(backupFilePath)
multi, err := os.ReadFile(backupFilePath)
require.NoError(st, err)
// Now that we have Dave's backup file, we'll
@@ -501,7 +500,7 @@ func runChanRestoreScenarioUnConfirmed(ht *lntest.HarnessTest, useFile bool) {
backupFilePath := dave.Cfg.ChanBackupPath()
// Read the entire Multi backup stored within this node's
// channel.backup file.
multi, err = ioutil.ReadFile(backupFilePath)
multi, err = os.ReadFile(backupFilePath)
require.NoError(ht, err)
} else {
// For this restoration method, we'll grab the current
@@ -646,7 +645,7 @@ func runChanRestoreScenarioCommitTypes(ht *lntest.HarnessTest,
// Read the entire Multi backup stored within this node's
// channels.backup file.
multi, err := ioutil.ReadFile(backupFilePath)
multi, err := os.ReadFile(backupFilePath)
require.NoError(ht, err)
// If this was a zero conf taproot channel, then since it's private,
@@ -774,7 +773,7 @@ func runChanRestoreScenarioForceClose(ht *lntest.HarnessTest, zeroConf bool) {
// Read the entire Multi backup stored within this node's
// channel.backup file.
multi, err := ioutil.ReadFile(backupFilePath)
multi, err := os.ReadFile(backupFilePath)
require.NoError(ht, err)
// Now that we have Dave's backup file, we'll create a new nodeRestorer
@@ -907,7 +906,7 @@ func testChannelBackupUpdates(ht *lntest.HarnessTest) {
// the on disk back up file to our currentBackup pointer above.
assertBackupFileState := func() {
err := wait.NoError(func() error {
packedBackup, err := ioutil.ReadFile(backupFilePath)
packedBackup, err := os.ReadFile(backupFilePath)
if err != nil {
return fmt.Errorf("unable to read backup "+
"file: %v", err)

View File

@@ -4,7 +4,7 @@ import (
"context"
"encoding/hex"
"fmt"
"io/ioutil"
"os"
"github.com/btcsuite/btcd/btcutil"
"github.com/btcsuite/btcd/txscript"
@@ -708,7 +708,7 @@ func testAbandonChannel(ht *lntest.HarnessTest) {
// To make sure the channel is removed from the backup file as well
// when being abandoned, grab a backup snapshot so we can compare it
// with the later state.
bkupBefore, err := ioutil.ReadFile(alice.Cfg.ChanBackupPath())
bkupBefore, err := os.ReadFile(alice.Cfg.ChanBackupPath())
require.NoError(ht, err, "channel backup before abandoning channel")
// Send request to abandon channel.
@@ -733,7 +733,7 @@ func testAbandonChannel(ht *lntest.HarnessTest) {
// Make sure the channel is no longer in the channel backup list.
err = wait.NoError(func() error {
bkupAfter, err := ioutil.ReadFile(alice.Cfg.ChanBackupPath())
bkupAfter, err := os.ReadFile(alice.Cfg.ChanBackupPath())
if err != nil {
return fmt.Errorf("could not get channel backup "+
"before abandoning channel: %v", err)