d5c2ab33fc
= 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
39 lines
1.1 KiB
Go
39 lines
1.1 KiB
Go
package fakes
|
|
|
|
import . "github.com/onsi/gomega"
|
|
|
|
type MockCryptoParser struct {
|
|
parsePublicKeyCalled bool
|
|
parsePublicKeyPassedPrivateKey string
|
|
parsePublicKeyReturnString string
|
|
parsePublicKeyReturnErr error
|
|
}
|
|
|
|
func NewMockCryptoParser() *MockCryptoParser {
|
|
return &MockCryptoParser{
|
|
parsePublicKeyCalled: false,
|
|
parsePublicKeyPassedPrivateKey: "",
|
|
parsePublicKeyReturnString: "",
|
|
parsePublicKeyReturnErr: nil,
|
|
}
|
|
}
|
|
|
|
func (mcp *MockCryptoParser) SetReturnVal(pubKey string) {
|
|
mcp.parsePublicKeyReturnString = pubKey
|
|
}
|
|
|
|
func (mcp *MockCryptoParser) SetReturnErr(err error) {
|
|
mcp.parsePublicKeyReturnErr = err
|
|
}
|
|
|
|
func (mcp *MockCryptoParser) ParsePublicKey(privateKey string) (string, error) {
|
|
mcp.parsePublicKeyCalled = true
|
|
mcp.parsePublicKeyPassedPrivateKey = privateKey
|
|
return mcp.parsePublicKeyReturnString, mcp.parsePublicKeyReturnErr
|
|
}
|
|
|
|
func (mcp *MockCryptoParser) AssertParsePublicKeyCalledWith(privateKey string) {
|
|
Expect(mcp.parsePublicKeyCalled).To(BeTrue())
|
|
Expect(mcp.parsePublicKeyPassedPrivateKey).To(Equal(privateKey))
|
|
}
|