Skip to content

Commit 1d20461

Browse files
authored
[vms/proposervm] Remove getForkHeight() (#2929)
1 parent 1ed9280 commit 1d20461

File tree

2 files changed

+2
-26
lines changed

2 files changed

+2
-26
lines changed

vms/proposervm/pre_fork_block.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func (b *preForkBlock) acceptInnerBlk(ctx context.Context) error {
3939
}
4040

4141
func (b *preForkBlock) Status() choices.Status {
42-
forkHeight, err := b.vm.getForkHeight()
42+
forkHeight, err := b.vm.GetForkHeight()
4343
if err == database.ErrNotFound {
4444
return b.Block.Status()
4545
}

vms/proposervm/vm.go

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ var (
5353
_ block.BatchedChainVM = (*VM)(nil)
5454
_ block.StateSyncableVM = (*VM)(nil)
5555

56-
// TODO: remove after the X-chain supports height indexing.
57-
mainnetXChainID = ids.FromStringOrPanic("2oYMBNV4eNHyqk2fjjV5nVQLDbtmNJzq5s3qs3Lo6ftnC6FByM")
58-
fujiXChainID = ids.FromStringOrPanic("2JVSBoinj9C2J33VntvzYtVJNZdN2NKiwwKjcumHUWEb5DbBrm")
59-
6056
dbPrefix = []byte("proposervm")
6157
)
6258

@@ -214,7 +210,7 @@ func (vm *VM) Initialize(
214210
return err
215211
}
216212

217-
forkHeight, err := vm.getForkHeight()
213+
forkHeight, err := vm.GetForkHeight()
218214
switch err {
219215
case nil:
220216
chainCtx.Log.Info("initialized proposervm",
@@ -575,26 +571,6 @@ func (vm *VM) getBlock(ctx context.Context, id ids.ID) (Block, error) {
575571
return vm.getPreForkBlock(ctx, id)
576572
}
577573

578-
// TODO: remove after the P-chain and X-chain support height indexing.
579-
func (vm *VM) getForkHeight() (uint64, error) {
580-
// The fork block can be easily identified with the provided links because
581-
// the `Parent Hash` is equal to the `Proposer Parent ID`.
582-
switch vm.ctx.ChainID {
583-
case constants.PlatformChainID:
584-
switch vm.ctx.NetworkID {
585-
case constants.MainnetID:
586-
return 805732, nil // https://subnets.avax.network/p-chain/block/805732
587-
case constants.FujiID:
588-
return 47529, nil // https://subnets-test.avax.network/p-chain/block/47529
589-
}
590-
case mainnetXChainID:
591-
return 1, nil // https://subnets.avax.network/x-chain/block/1
592-
case fujiXChainID:
593-
return 1, nil // https://subnets-test.avax.network/x-chain/block/1
594-
}
595-
return vm.GetForkHeight()
596-
}
597-
598574
func (vm *VM) getPostForkBlock(ctx context.Context, blkID ids.ID) (PostForkBlock, error) {
599575
block, exists := vm.verifiedBlocks[blkID]
600576
if exists {

0 commit comments

Comments
 (0)