lnd_test+lntest: move copyFile() -> lntest.CopyFile()

This commit is contained in:
Johan T. Halseth committed 2018-11-27 10:21:17 +01:00
1 parent 0348db760e
commit 3a2fd51f2f
2 files changed
+27 -24

No files matched your search

+23
View File
@@ -3,7 +3,9 @@ package lntest
import (
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"strings"
"sync"
"time"
@@ -1266,3 +1268,24 @@ func (n *NetworkHarness) sendCoins(ctx context.Context, amt btcutil.Amount,
expectedBalance := initialBalance.ConfirmedBalance + int64(amt)
return target.WaitForBalance(expectedBalance, true)
}
// CopyFile copies the file src to dest.
func CopyFile(dest, src string) error {
s, err := os.Open(src)
if err != nil {
return err
}
defer s.Close()
d, err := os.Create(dest)
if err != nil {
return err
}
if _, err := io.Copy(d, s); err != nil {
d.Close()
return err
}
return d.Close()
}