forked from cerc-io/ipld-eth-server
internalized ipld types and dag_putters; adjust converters/publishers to work with them
This commit is contained in:
@@ -25,22 +25,26 @@ import (
|
||||
// DagPutter is a mock for testing the ipfs publisher
|
||||
type DagPutter struct {
|
||||
CIDsToReturn []string
|
||||
PassedRaw interface{}
|
||||
ErrToReturn error
|
||||
}
|
||||
|
||||
// DagPut returns the pre-loaded CIDs or error
|
||||
func (dp *DagPutter) DagPut(raw interface{}) ([]string, error) {
|
||||
dp.PassedRaw = raw
|
||||
return dp.CIDsToReturn, dp.ErrToReturn
|
||||
}
|
||||
|
||||
// MappedDagPutter is a mock for testing the ipfs publisher
|
||||
type MappedDagPutter struct {
|
||||
CIDsToReturn map[common.Hash][]string
|
||||
PassedRaw interface{}
|
||||
ErrToReturn error
|
||||
}
|
||||
|
||||
// DagPut returns the pre-loaded CIDs or error
|
||||
func (mdp *MappedDagPutter) DagPut(raw interface{}) ([]string, error) {
|
||||
mdp.PassedRaw = raw
|
||||
if mdp.CIDsToReturn == nil {
|
||||
return nil, errors.New("mapped dag putter needs to be initialized with a map of cids to return")
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ package mocks
|
||||
import (
|
||||
"github.com/ethereum/go-ethereum/rpc"
|
||||
"github.com/ethereum/go-ethereum/statediff"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/super_node/shared"
|
||||
)
|
||||
|
||||
// StateDiffStreamer is the underlying struct for the Streamer interface
|
||||
@@ -30,7 +31,7 @@ type StateDiffStreamer struct {
|
||||
}
|
||||
|
||||
// Stream is the main loop for subscribing to data from the Geth state diff process
|
||||
func (sds *StateDiffStreamer) Stream(payloadChan chan interface{}) (*rpc.ClientSubscription, error) {
|
||||
func (sds *StateDiffStreamer) Stream(payloadChan chan interface{}) (shared.ClientSubscription, error) {
|
||||
sds.PassedPayloadChan = payloadChan
|
||||
|
||||
go func() {
|
||||
|
||||
@@ -237,7 +237,6 @@ var (
|
||||
TotalDifficulty: big.NewInt(1337),
|
||||
Block: MockBlock,
|
||||
Receipts: MockReceipts,
|
||||
HeaderRLP: MockHeaderRlp,
|
||||
TxMetaData: MockTrxMeta,
|
||||
ReceiptMetaData: MockRctMeta,
|
||||
StorageNodes: MockStorageNodes,
|
||||
|
||||
Reference in New Issue
Block a user