1355271011
- Only syncs block headers (excludes block bodies, transactions, receipts, and logs) - Modifies validation window to include the most recent block - Isolates validation window to the variable defined in the cmd directory (blocks have a separate variable defined in the block_repository for determining when to set a block as final)
33 lines
908 B
Go
33 lines
908 B
Go
package inmemory
|
|
|
|
import (
|
|
"github.com/vulcanize/vulcanizedb/pkg/core"
|
|
"github.com/vulcanize/vulcanizedb/pkg/filters"
|
|
)
|
|
|
|
const (
|
|
blocksFromHeadBeforeFinal = 20
|
|
)
|
|
|
|
type InMemory struct {
|
|
CreateOrUpdateBlockCallCount int
|
|
blocks map[int64]core.Block
|
|
contracts map[string]core.Contract
|
|
headers map[int64]core.Header
|
|
logFilters map[string]filters.LogFilter
|
|
logs map[string][]core.Log
|
|
receipts map[string]core.Receipt
|
|
}
|
|
|
|
func NewInMemory() *InMemory {
|
|
return &InMemory{
|
|
CreateOrUpdateBlockCallCount: 0,
|
|
blocks: make(map[int64]core.Block),
|
|
contracts: make(map[string]core.Contract),
|
|
headers: make(map[int64]core.Header),
|
|
logFilters: make(map[string]filters.LogFilter),
|
|
logs: make(map[string][]core.Log),
|
|
receipts: make(map[string]core.Receipt),
|
|
}
|
|
}
|