mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 15:37:56 -05:00
Block backfilling (#12968)
* backfill service * fix bug where origin state is never unlocked * support mvslice states * use renamed interface * refactor db code to skip block cache for backfill * lint * add test for verifier.verify * enable service in service init test * cancellation cleanup * adding nil checks to configset juggling * assume blocks are available by default As long as we're sure the AvailableBlocker is initialized correctly during node startup, defaulting to assuming we aren't in a checkpoint sync simplifies things greatly for tests. * block saving path refactor and bugfix * fix fillback test * fix BackfillStatus init tests --------- Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
This commit is contained in:
@@ -169,19 +169,28 @@ func ErrorContains(loggerFn assertionLoggerFn, want string, err error, msg ...in
|
||||
|
||||
// NotNil asserts that passed value is not nil.
|
||||
func NotNil(loggerFn assertionLoggerFn, obj interface{}, msg ...interface{}) {
|
||||
if isNil(obj) {
|
||||
if deepNil(obj) {
|
||||
errMsg := parseMsg("Unexpected nil value", msg...)
|
||||
_, file, line, _ := runtime.Caller(2)
|
||||
loggerFn("%s:%d %s", filepath.Base(file), line, errMsg)
|
||||
}
|
||||
}
|
||||
|
||||
// isNil checks that underlying value of obj is nil.
|
||||
func isNil(obj interface{}) bool {
|
||||
if obj == nil {
|
||||
// IsNil asserts that observed value is nil.
|
||||
func IsNil(loggerFn assertionLoggerFn, got interface{}, msg ...interface{}) {
|
||||
if !deepNil(got) {
|
||||
errMsg := parseMsg("Value is unexpectedly not nil", msg...)
|
||||
_, file, line, _ := runtime.Caller(2)
|
||||
loggerFn("%s:%d %s", filepath.Base(file), line, errMsg)
|
||||
}
|
||||
}
|
||||
|
||||
// deepNil checks that underlying value of obj is nil.
|
||||
func deepNil(got interface{}) bool {
|
||||
if got == nil {
|
||||
return true
|
||||
}
|
||||
value := reflect.ValueOf(obj)
|
||||
value := reflect.ValueOf(got)
|
||||
switch value.Kind() {
|
||||
case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice, reflect.UnsafePointer:
|
||||
return value.IsNil()
|
||||
|
||||
Reference in New Issue
Block a user