internalized ipld types and dag_putters; adjust converters/publishers to work with them

This commit is contained in:
Ian Norden
2020-02-20 16:14:17 -06:00
parent 2e81f8d31a
commit 8099f726c3
45 changed files with 2556 additions and 94 deletions
+4
View File
@@ -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")
}
+2 -1
View File
@@ -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() {
-1
View File
@@ -237,7 +237,6 @@ var (
TotalDifficulty: big.NewInt(1337),
Block: MockBlock,
Receipts: MockReceipts,
HeaderRLP: MockHeaderRlp,
TxMetaData: MockTrxMeta,
ReceiptMetaData: MockRctMeta,
StorageNodes: MockStorageNodes,