Sync only missing blocks on cold import

= Add eth_node_fingerprint to block that can be imitated by both hot and cold imports
- Only sync missing blocks (blocks that are missing or don't share a fingerprint) on cold import
- Set block is_final status after import
This commit is contained in:
Rob Mulholand
2018-05-07 16:38:04 -05:00
parent 5a5e08bd13
commit d5c2ab33fc
31 changed files with 616 additions and 171 deletions
+38
View File
@@ -0,0 +1,38 @@
package fakes
import . "github.com/onsi/gomega"
type MockFsReader struct {
readCalled bool
readPassedPath string
readReturnBytes []byte
readReturnErr error
}
func NewMockFsReader() *MockFsReader {
return &MockFsReader{
readCalled: false,
readPassedPath: "",
readReturnBytes: nil,
readReturnErr: nil,
}
}
func (mfr *MockFsReader) SetReturnBytes(returnBytes []byte) {
mfr.readReturnBytes = returnBytes
}
func (mfr *MockFsReader) SetReturnErr(err error) {
mfr.readReturnErr = err
}
func (mfr *MockFsReader) Read(path string) ([]byte, error) {
mfr.readCalled = true
mfr.readPassedPath = path
return mfr.readReturnBytes, mfr.readReturnErr
}
func (mfr *MockFsReader) AssertReadCalledWith(path string) {
Expect(mfr.readCalled).To(BeTrue())
Expect(mfr.readPassedPath).To(Equal(path))
}