github.com/annchain/OG@v0.0.9/vm/ovm/config.go (about) 1 // Copyright 2016 The go-ethereum Authors 2 // This file is part of the go-ethereum library. 3 // 4 // The go-ethereum library is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU Lesser General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // The go-ethereum library is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU Lesser General Public License for more details. 13 // 14 // You should have received a copy of the GNU Lesser General Public License 15 // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. 16 17 package ovm 18 19 import ( 20 "fmt" 21 "math/big" 22 ) 23 24 // ChainConfig is the core config which determines the blockchain settings. 25 // 26 // ChainConfig is stored in the database on a per block basis. This means 27 // that any network, identified by its genesis block, can have its own 28 // set of configuration options. 29 type ChainConfig struct { 30 ChainID uint32 `json:"chainId"` // chainId identifies the current chain and is used for replay protection 31 } 32 33 // String implements the fmt.Stringer interface. 34 func (c *ChainConfig) String() string { 35 return fmt.Sprintf("{ChainID: %v}", 36 c.ChainID, 37 ) 38 } 39 40 // ConfigCompatError is raised if the locally-stored blockchain is initialised with a 41 // ChainConfig that would alter the past. 42 type ConfigCompatError struct { 43 What string 44 // block numbers of the stored and new configurations 45 StoredConfig, NewConfig *big.Int 46 // the block number to which the local chain must be rewound to correct the error 47 RewindTo uint64 48 } 49 50 func (err *ConfigCompatError) Error() string { 51 return fmt.Sprintf("mismatching %s in database (have %d, want %d, rewindto %d)", err.What, err.StoredConfig, err.NewConfig, err.RewindTo) 52 } 53 54 var TestChainConfig = &ChainConfig{0} 55 56 type OVMConfig struct { 57 // NoRecursion disabled Interpreter call, callcode, 58 // delegate call and create. 59 NoRecursion bool 60 }