ipld-eth-server/fakes/blockchain.go
Eric Meyer de2cb3b5cc Start introducing domain concepts
* Potential observers include a logger and/or an observer that writes to the DB
2017-10-23 12:08:59 -05:00

20 lines
429 B
Go

package fakes
import (
"github.com/8thlight/vulcanizedb/core"
)
type Blockchain struct {
observers []core.BlockchainObserver
}
func (blockchain *Blockchain) RegisterObserver(observer core.BlockchainObserver) {
blockchain.observers = append(blockchain.observers, observer)
}
func (blockchain *Blockchain) AddBlock(block core.Block) {
for _, observer := range blockchain.observers {
observer.NotifyBlockAdded(block)
}
}