Skip to content

Commit

Permalink
change permission
Browse files Browse the repository at this point in the history
  • Loading branch information
rameight committed Jun 6, 2023
1 parent acd1ee6 commit 41a75a0
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion consensus/wal.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ var _ WAL = &BaseWAL{}
// NewWAL returns a new write-ahead logger based on `baseWAL`, which implements
// WAL. It's flushed and synced to disk every 2s and once when stopped.
func NewWAL(walFile string, groupOptions ...func(*auto.Group)) (*BaseWAL, error) {
err := kos.EnsureDir(filepath.Dir(walFile), 0700)
err := kos.EnsureDir(filepath.Dir(walFile), 0777)
if err != nil {
return nil, fmt.Errorf("failed to ensure WAL directory is in place: %w", err)
}
Expand Down
4 changes: 2 additions & 2 deletions kai/accounts/keystore/account_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func TestWatchNoDir(t *testing.T) {
time.Sleep(100 * time.Millisecond)

// Create the directory and copy a key file into it.
os.MkdirAll(dir, 0700)
os.MkdirAll(dir, 0777)
defer os.RemoveAll(dir)
file := filepath.Join(dir, "aaa")
if err := cp.CopyFile(file, cachetestAccounts[0].URL.Path); err != nil {
Expand Down Expand Up @@ -335,7 +335,7 @@ func TestUpdatedKeyfileContents(t *testing.T) {
time.Sleep(100 * time.Millisecond)

// Create the directory and copy a key file into it.
os.MkdirAll(dir, 0700)
os.MkdirAll(dir, 0777)
defer os.RemoveAll(dir)
file := filepath.Join(dir, "aaa")

Expand Down
2 changes: 1 addition & 1 deletion kai/accounts/keystore/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func storeNewKey(ks keyStore, rand io.Reader, auth string) (*Key, accounts.Accou
func writeTemporaryKeyFile(file string, content []byte) (string, error) {
// Create the keystore directory with appropriate permissions
// in case it is not present yet.
const dirPerm = 0700
const dirPerm = 0777
if err := os.MkdirAll(filepath.Dir(file), dirPerm); err != nil {
return "", err
}
Expand Down
2 changes: 1 addition & 1 deletion lib/autofile/group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
func createTestGroupWithHeadSizeLimit(t *testing.T, headSizeLimit int64) *Group {
testID := krand.Str(12)
testDir := "_test_" + testID
err := kos.EnsureDir(testDir, 0700)
err := kos.EnsureDir(testDir, 0777)
require.NoError(t, err, "Error creating dir")

headPath := testDir + "/myfile"
Expand Down
29 changes: 14 additions & 15 deletions mainchain/tx_pool/tx_pool_helper.go
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
package tx_pool

import (
"io"
"net/http"
"strings"
"time"

"github.com/kardiachain/go-kardia/lib/common"
"github.com/kardiachain/go-kardia/lib/log"
)

// UpdateBlacklist fetch and overwrite the current blacklist
func UpdateBlacklist(timeout time.Duration) error {
httpClient := http.Client{Timeout: timeout}
resp, err := httpClient.Get(blacklistURL)
if err != nil {
log.Warn("Cannot get blacklisted addresses", "err", err)
return err
}
body, err := io.ReadAll(resp.Body)
if err != nil {
log.Warn("Cannot import blacklisted addresses", "err", err)
return err
}
blacklisted := strings.Split(string(body), "\n")
// httpClient := http.Client{Timeout: timeout}
// resp, err := httpClient.Get(blacklistURL)
// if err != nil {
// log.Warn("Cannot get blacklisted addresses", "err", err)
// return err
// }
// body, err := io.ReadAll(resp.Body)
// if err != nil {
// log.Warn("Cannot import blacklisted addresses", "err", err)
// return err
// }
// blacklisted := strings.Split(string(body), "\n")

blacklisted := strings.Split("", "\n")
for _, str := range blacklisted {
Blacklisted[common.HexToAddress(str).Hex()] = true
}
Expand Down
4 changes: 2 additions & 2 deletions node/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ func (c *Config) NodeKey() *ecdsa.PrivateKey {
log.Crit(fmt.Sprintf("Failed to generate node key: %v", err))
}
instanceDir := filepath.Join(c.DataDir, c.name())
if err := os.MkdirAll(instanceDir, 0700); err != nil {
if err := os.MkdirAll(instanceDir, 0777); err != nil {
log.Error(fmt.Sprintf("Failed to persist node key: %v", err))
return key
}
Expand Down Expand Up @@ -488,7 +488,7 @@ func getKeyStoreDir(conf *Config) (string, bool, error) {
if err != nil {
return "", false, err
}
if err := os.MkdirAll(keydir, 0700); err != nil {
if err := os.MkdirAll(keydir, 0777); err != nil {
return "", false, err
}

Expand Down
3 changes: 2 additions & 1 deletion node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ func (n *Node) OnStart() error {
if err := n.transport.Listen(*addr); err != nil {
return err
}
n.Logger.Info("Transport started", n.config.P2P.ListenAddress)

// Otherwise copy and specialize the P2P configuration
services := make(map[reflect.Type]Service)
Expand Down Expand Up @@ -324,7 +325,7 @@ func (n *Node) openDataDir() error {
}

instdir := filepath.Join(n.config.DataDir, n.config.name())
if err := os.MkdirAll(instdir, 0700); err != nil {
if err := os.MkdirAll(instdir, 0777); err != nil {
return err
}
// Lock the instance directory to prevent concurrent use by another instance as well as
Expand Down

0 comments on commit 41a75a0

Please sign in to comment.