forked from cerc-io/ipld-eth-server
266c9587c8
* Update Block w/ newest Block * Add cascading delete to blocks and transactions tables * Add handling for new conflicting blocks * Command line version of sliding window n behind HEAD
19 lines
469 B
Go
19 lines
469 B
Go
package observers
|
|
|
|
import (
|
|
"github.com/8thlight/vulcanizedb/pkg/core"
|
|
"github.com/8thlight/vulcanizedb/pkg/repositories"
|
|
)
|
|
|
|
type BlockchainDbObserver struct {
|
|
repository repositories.Repository
|
|
}
|
|
|
|
func NewBlockchainDbObserver(repository repositories.Repository) BlockchainDbObserver {
|
|
return BlockchainDbObserver{repository: repository}
|
|
}
|
|
|
|
func (observer BlockchainDbObserver) NotifyBlockAdded(block core.Block) {
|
|
observer.repository.CreateOrUpdateBlock(block)
|
|
}
|