OSDN Git Service

fix cache (#463)
authorChengcheng Zhang <943420582@qq.com>
Fri, 6 Dec 2019 07:37:13 +0000 (15:37 +0800)
committerPaladz <yzhu101@uottawa.ca>
Fri, 6 Dec 2019 07:37:13 +0000 (15:37 +0800)
* fix cache

* update

.github/workflows/test.yml [deleted file]
database/cache.go
database/store.go

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
deleted file mode 100644 (file)
index c7ec7f6..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-name: Go Test
-on:
-  push:
-    branches:
-    - master
-    - dev
-  pull_request:
-    branches:
-    - master
-    - dev
-
-jobs:
-  build:
-    name: Test
-    runs-on: ubuntu-latest
-    steps:
-
-    - name: Set up Go 1.13
-      uses: actions/setup-go@v1
-      with:
-        go-version: 1.13
-      id: go
-
-    - name: Check out code into the Go module directory
-      uses: actions/checkout@v1
-
-    - name: Get dependencies
-      run: go get -v -t -d ./...
-
-    - name: Run Tests
-      run: make test
-
index a24ac8a..e6fb4d8 100644 (file)
@@ -25,8 +25,8 @@ type fillBlockHashesFn func(height uint64) ([]*bc.Hash, error)
 type fillMainChainHashFn func(height uint64) (*bc.Hash, error)
 type fillConsensusResultFn func(seq uint64) (*state.ConsensusResult, error)
 
 type fillMainChainHashFn func(height uint64) (*bc.Hash, error)
 type fillConsensusResultFn func(seq uint64) (*state.ConsensusResult, error)
 
-func newCache(fillBlockHeader fillBlockHeaderFn, fillBlockTxs fillBlockTransactionsFn, fillBlockHashes fillBlockHashesFn, fillMainChainHash fillMainChainHashFn, fillConsensusResult fillConsensusResultFn) cache {
-       return cache{
+func newCache(fillBlockHeader fillBlockHeaderFn, fillBlockTxs fillBlockTransactionsFn, fillBlockHashes fillBlockHashesFn, fillMainChainHash fillMainChainHashFn, fillConsensusResult fillConsensusResultFn) *cache {
+       return &cache{
                lruBlockHeaders:     common.NewCache(maxCachedBlockHeaders),
                lruBlockTxs:         common.NewCache(maxCachedBlockTransactions),
                lruBlockHashes:      common.NewCache(maxCachedBlockHashes),
                lruBlockHeaders:     common.NewCache(maxCachedBlockHeaders),
                lruBlockTxs:         common.NewCache(maxCachedBlockTransactions),
                lruBlockHashes:      common.NewCache(maxCachedBlockHashes),
index 0be3df0..bff69c6 100644 (file)
@@ -53,7 +53,7 @@ func loadBlockStoreStateJSON(db dbm.DB) *protocol.BlockStoreState {
 // methods for querying current data.
 type Store struct {
        db    dbm.DB
 // methods for querying current data.
 type Store struct {
        db    dbm.DB
-       cache cache
+       cache *cache
 }
 
 func calcMainChainIndexPrefix(height uint64) []byte {
 }
 
 func calcMainChainIndexPrefix(height uint64) []byte {