2017-10-23 15:56:29 +00:00
|
|
|
package fakes
|
|
|
|
|
2017-11-06 18:53:43 +00:00
|
|
|
import "github.com/8thlight/vulcanizedb/pkg/core"
|
2017-10-23 15:56:29 +00:00
|
|
|
|
|
|
|
type Blockchain struct {
|
2017-11-03 13:54:32 +00:00
|
|
|
outputBlocks chan core.Block
|
|
|
|
WasToldToStop bool
|
2017-10-23 15:56:29 +00:00
|
|
|
}
|
|
|
|
|
2017-11-02 11:41:24 +00:00
|
|
|
func (blockchain *Blockchain) SubscribeToBlocks(outputBlocks chan core.Block) {
|
|
|
|
blockchain.outputBlocks = outputBlocks
|
2017-10-23 15:56:29 +00:00
|
|
|
}
|
|
|
|
|
2017-11-02 11:41:24 +00:00
|
|
|
func (blockchain Blockchain) AddBlock(block core.Block) {
|
|
|
|
blockchain.outputBlocks <- block
|
2017-10-23 15:56:29 +00:00
|
|
|
}
|
2017-10-23 18:58:33 +00:00
|
|
|
|
2017-11-02 11:41:24 +00:00
|
|
|
func (*Blockchain) StartListening() {}
|
2017-11-03 13:54:32 +00:00
|
|
|
|
|
|
|
func (blockchain *Blockchain) StopListening() {
|
|
|
|
blockchain.WasToldToStop = true
|
|
|
|
}
|