MCPcopy Create free account
hub / github.com/ethstorage/es-node / NewMockL1Source

Function NewMockL1Source

ethstorage/p2p/protocol/sync_test.go:84–94  ·  view source on GitHub ↗
(lastBlobIndex uint64, metafile string)

Source from the content-addressed store, hash-verified

82}
83
84func NewMockL1Source(lastBlobIndex uint64, metafile string) *mockL1Source {
85 if len(metafile) == 0 {
86 panic("metafile param is needed when using mock l1")
87 }
88
89 file, err := os.OpenFile(metafile, os.O_RDONLY, 0600)
90 if err != nil {
91 panic(fmt.Sprintf("open metafile fail with err %s", err.Error()))
92 }
93 return &mockL1Source{lastBlobIndex: lastBlobIndex, metaFile: file}
94}
95
96func (l1 *mockL1Source) getMetadata(idx uint64) ([32]byte, error) {
97 bs := make([]byte, 32)

Callers 8

TestSync_RequestL2RangeFunction · 0.85
TestSync_RequestL2ListFunction · 0.85
testSyncFunction · 0.85
TestAddPeerDuringSyncingFunction · 0.85
TestAddPeerAfterSyncDoneFunction · 0.85
TestFillEmptyFunction · 0.85

Calls 1

ErrorMethod · 0.45

Tested by

no test coverage detected