Merge pull request #444 from cosmos/bez/442-disable-pruning-default

Disable IAVL Pruning
This commit is contained in:
Jack Zampolin 2018-07-17 19:29:31 -07:00 committed by GitHub
commit 4ba51125bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 4 deletions

15
main.go
View File

@ -27,9 +27,10 @@ import (
dbm "github.com/tendermint/tendermint/libs/db"
)
var cpuprofile = flag.String("cpuprofile", "", "write cpu profile `file`")
var cpuprofile = flag.String("cpu-profile", "", "write cpu profile `file`")
var blockchain = flag.String("blockchain", "data/blockchain", "file containing blocks to load")
var datadir = flag.String("datadir", "", "directory for ethermint data")
var blockStop = flag.Int("stop-block", 10000, "stop prematurely after processing a certain number of blocks")
var (
// TODO: Document...
@ -40,16 +41,19 @@ var (
// TODO: Document...
func main() {
flag.Parse()
if *cpuprofile != "" {
f, err := os.Create(*cpuprofile)
if err != nil {
fmt.Printf("could not create CPU profile: %v\n", err)
return
}
if err := pprof.StartCPUProfile(f); err != nil {
fmt.Printf("could not start CPU profile: %v\n", err)
return
}
defer pprof.StopCPUProfile()
}
@ -220,9 +224,11 @@ func main() {
if (n % 10000) == 0 {
fmt.Printf("processed %d blocks, time so far: %v\n", n, time.Since(startTime))
}
//if n >= 20000 {
// break
//}
if *blockStop == n {
fmt.Println("haulting process prematurely")
break
}
}
fmt.Printf("processed %d blocks\n", n)
@ -249,6 +255,7 @@ func main() {
if err != nil {
panic(err)
}
miner501BalanceAt501 := state501.GetBalance(miner501)
fmt.Printf("investor's balance after block 500: %d\n", state500.GetBalance(genInvestor))

View File

@ -3,6 +3,7 @@ package state
import (
"github.com/cosmos/cosmos-sdk/store"
"github.com/cosmos/cosmos-sdk/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/ethermint/core"
ethcommon "github.com/ethereum/go-ethereum/common"
ethstate "github.com/ethereum/go-ethereum/core/state"
@ -69,6 +70,9 @@ func NewDatabase(stateDB, codeDB dbm.DB) (*Database, error) {
stateStore: store.NewCommitMultiStore(stateDB),
}
// currently do not prune any historical state
db.stateStore.SetPruning(sdk.PruneNothing)
// Create the underlying multi-store stores that will persist account and
// account storage data.
db.stateStore.MountStoreWithDB(AccountsKey, types.StoreTypeIAVL, nil)