github.com/MetalBlockchain/subnet-evm@v0.4.9/plugin/evm/service.go (about) 1 // (c) 2019-2020, Ava Labs, Inc. All rights reserved. 2 // See the file LICENSE for licensing terms. 3 4 package evm 5 6 import ( 7 "context" 8 "math/big" 9 10 "github.com/ethereum/go-ethereum/common" 11 "github.com/ethereum/go-ethereum/log" 12 ) 13 14 // test constants 15 const ( 16 GenesisTestAddr = "0x751a0b96e1042bee789452ecb20253fba40dbe85" 17 GenesisTestKey = "0xabd71b35d559563fea757f0f5edbde286fb8c043105b15abb7cd57189306d7d1" 18 ) 19 20 // SnowmanAPI introduces snowman specific functionality to the evm 21 type SnowmanAPI struct{ vm *VM } 22 23 // GetAcceptedFrontReply defines the reply that will be sent from the 24 // GetAcceptedFront API call 25 type GetAcceptedFrontReply struct { 26 Hash common.Hash `json:"hash"` 27 Number *big.Int `json:"number"` 28 } 29 30 // GetAcceptedFront returns the last accepted block's hash and height 31 func (api *SnowmanAPI) GetAcceptedFront(ctx context.Context) (*GetAcceptedFrontReply, error) { 32 blk := api.vm.blockChain.LastConsensusAcceptedBlock() 33 return &GetAcceptedFrontReply{ 34 Hash: blk.Hash(), 35 Number: blk.Number(), 36 }, nil 37 } 38 39 // IssueBlock to the chain 40 func (api *SnowmanAPI) IssueBlock(ctx context.Context) error { 41 log.Info("Issuing a new block") 42 43 api.vm.builder.signalTxsReady() 44 return nil 45 }