File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ import (
54
54
55
55
var (
56
56
_ block.ChainVM = (* VM )(nil )
57
+ _ block.HeightIndexedChainVM = (* VM )(nil )
57
58
_ secp256k1fx.VM = (* VM )(nil )
58
59
_ validators.State = (* VM )(nil )
59
60
_ validators.SubnetConnector = (* VM )(nil )
@@ -88,6 +89,9 @@ type VM struct {
88
89
89
90
txBuilder txbuilder.Builder
90
91
manager blockexecutor.Manager
92
+
93
+ // TODO: Remove after v1.11.x is activated
94
+ pruned utils.Atomic [bool ]
91
95
}
92
96
93
97
// Initialize this blockchain.
@@ -222,6 +226,8 @@ func (vm *VM) Initialize(
222
226
zap .Error (err ),
223
227
)
224
228
}
229
+
230
+ vm .pruned .Set (true )
225
231
}()
226
232
227
233
return nil
@@ -467,3 +473,15 @@ func (vm *VM) Clock() *mockable.Clock {
467
473
func (vm * VM ) Logger () logging.Logger {
468
474
return vm .ctx .Log
469
475
}
476
+
477
+ func (vm * VM ) VerifyHeightIndex (_ context.Context ) error {
478
+ if vm .pruned .Get () {
479
+ return nil
480
+ }
481
+
482
+ return block .ErrIndexIncomplete
483
+ }
484
+
485
+ func (vm * VM ) GetBlockIDAtHeight (_ context.Context , height uint64 ) (ids.ID , error ) {
486
+ return vm .state .GetBlockIDAtHeight (height )
487
+ }
You can’t perform that action at this time.
0 commit comments