forked from cerc-io/laconicd-deprecated
Merge pull request #444 from cosmos/bez/442-disable-pruning-default
Disable IAVL Pruning
This commit is contained in:
commit
4ba51125bb
15
main.go
15
main.go
@ -27,9 +27,10 @@ import (
|
|||||||
dbm "github.com/tendermint/tendermint/libs/db"
|
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 blockchain = flag.String("blockchain", "data/blockchain", "file containing blocks to load")
|
||||||
var datadir = flag.String("datadir", "", "directory for ethermint data")
|
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 (
|
var (
|
||||||
// TODO: Document...
|
// TODO: Document...
|
||||||
@ -40,16 +41,19 @@ var (
|
|||||||
// TODO: Document...
|
// TODO: Document...
|
||||||
func main() {
|
func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
if *cpuprofile != "" {
|
if *cpuprofile != "" {
|
||||||
f, err := os.Create(*cpuprofile)
|
f, err := os.Create(*cpuprofile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("could not create CPU profile: %v\n", err)
|
fmt.Printf("could not create CPU profile: %v\n", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := pprof.StartCPUProfile(f); err != nil {
|
if err := pprof.StartCPUProfile(f); err != nil {
|
||||||
fmt.Printf("could not start CPU profile: %v\n", err)
|
fmt.Printf("could not start CPU profile: %v\n", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
defer pprof.StopCPUProfile()
|
defer pprof.StopCPUProfile()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,9 +224,11 @@ func main() {
|
|||||||
if (n % 10000) == 0 {
|
if (n % 10000) == 0 {
|
||||||
fmt.Printf("processed %d blocks, time so far: %v\n", n, time.Since(startTime))
|
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)
|
fmt.Printf("processed %d blocks\n", n)
|
||||||
@ -249,6 +255,7 @@ func main() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
miner501BalanceAt501 := state501.GetBalance(miner501)
|
miner501BalanceAt501 := state501.GetBalance(miner501)
|
||||||
|
|
||||||
fmt.Printf("investor's balance after block 500: %d\n", state500.GetBalance(genInvestor))
|
fmt.Printf("investor's balance after block 500: %d\n", state500.GetBalance(genInvestor))
|
||||||
|
@ -3,6 +3,7 @@ package state
|
|||||||
import (
|
import (
|
||||||
"github.com/cosmos/cosmos-sdk/store"
|
"github.com/cosmos/cosmos-sdk/store"
|
||||||
"github.com/cosmos/cosmos-sdk/types"
|
"github.com/cosmos/cosmos-sdk/types"
|
||||||
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
"github.com/cosmos/ethermint/core"
|
"github.com/cosmos/ethermint/core"
|
||||||
ethcommon "github.com/ethereum/go-ethereum/common"
|
ethcommon "github.com/ethereum/go-ethereum/common"
|
||||||
ethstate "github.com/ethereum/go-ethereum/core/state"
|
ethstate "github.com/ethereum/go-ethereum/core/state"
|
||||||
@ -69,6 +70,9 @@ func NewDatabase(stateDB, codeDB dbm.DB) (*Database, error) {
|
|||||||
stateStore: store.NewCommitMultiStore(stateDB),
|
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
|
// Create the underlying multi-store stores that will persist account and
|
||||||
// account storage data.
|
// account storage data.
|
||||||
db.stateStore.MountStoreWithDB(AccountsKey, types.StoreTypeIAVL, nil)
|
db.stateStore.MountStoreWithDB(AccountsKey, types.StoreTypeIAVL, nil)
|
||||||
|
Loading…
Reference in New Issue
Block a user