Skip to content

Commit

Permalink
feat: decrease db block chunk size
Browse files Browse the repository at this point in the history
  • Loading branch information
dudong2 committed Mar 8, 2023
1 parent d4d6557 commit 100d340
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -1461,7 +1461,7 @@ func saveGenesisDoc(db dbm.DB, genDoc *types.GenesisDoc) error {
return fmt.Errorf("failed to save genesis doc due to marshaling error: %w", err)
}

blockSize := 0x40000000 // 1gb
blockSize := 0x8000000 // 100mb
blocks := make([][]byte, 0)
for i := 0; i < len(b); i += blockSize {
end := i + blockSize
Expand Down
3 changes: 2 additions & 1 deletion node/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -616,13 +616,14 @@ func TestSaveAndLoadBigGensisFile(t *testing.T) {
defer os.RemoveAll(config.RootDir)
n, err := DefaultNewNode(config, log.TestingLogger())
require.NoError(t, err)
newChainID := strings.Repeat("a", 2000000000) // about 2GB
newChainID := strings.Repeat("a", 300000000) // about 300MB
n.genesisDoc.ChainID = newChainID
err = saveGenesisDoc(stateDB, n.genesisDoc)
require.NoError(t, err)
g, err := loadGenesisDoc(stateDB)
require.NoError(t, err)
require.Equal(t, newChainID, g.ChainID)
stateDB.Close()
}

func NewInvalidNode(config *cfg.Config,
Expand Down

0 comments on commit 100d340

Please sign in to comment.