diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go
index f0a211b806..d490ee41dd 100644
--- a/cmd/utils/cmd.go
+++ b/cmd/utils/cmd.go
@@ -5,13 +5,12 @@ import (
"github.com/dominant-strategies/go-quai/common"
"github.com/dominant-strategies/go-quai/core/vm"
- "github.com/dominant-strategies/go-quai/eth"
- quai "github.com/dominant-strategies/go-quai/eth"
- "github.com/dominant-strategies/go-quai/eth/ethconfig"
"github.com/dominant-strategies/go-quai/internal/quaiapi"
"github.com/dominant-strategies/go-quai/log"
"github.com/dominant-strategies/go-quai/node"
"github.com/dominant-strategies/go-quai/params"
+ "github.com/dominant-strategies/go-quai/quai"
+ "github.com/dominant-strategies/go-quai/quai/quaiconfig"
"github.com/dominant-strategies/go-quai/quaistats"
"github.com/spf13/viper"
"io"
@@ -25,7 +24,7 @@ type quaistatsConfig struct {
}
type quaiConfig struct {
- Quai ethconfig.Config
+ Quai quaiconfig.Config
Node node.Config
Ethstats quaistatsConfig
}
@@ -62,7 +61,7 @@ func StartQuaiBackend() (*quai.QuaiBackend, error) {
stackZone.Wait()
}()
- return ð.QuaiBackend{}, nil
+ return &quai.QuaiBackend{}, nil
}
func StartNode(stack *node.Node) {
@@ -76,7 +75,7 @@ func StartNode(stack *node.Node) {
func makeConfigNode(nodeLocation common.Location) (*node.Node, quaiConfig) {
// Load defaults.
cfg := quaiConfig{
- Quai: ethconfig.Defaults,
+ Quai: quaiconfig.Defaults,
Node: defaultNodeConfig(),
}
@@ -129,8 +128,8 @@ func makeFullNode(nodeLocation common.Location) *node.Node {
// RegisterQuaiService adds a Quai client to the stack.
// The second return value is the full node instance, which may be nil if the
// node is running as a light client.
-func RegisterQuaiService(stack *node.Node, cfg ethconfig.Config, nodeCtx int) (quaiapi.Backend, error) {
- backend, err := eth.New(stack, &cfg, nodeCtx)
+func RegisterQuaiService(stack *node.Node, cfg quaiconfig.Config, nodeCtx int) (quaiapi.Backend, error) {
+ backend, err := quai.New(stack, &cfg, nodeCtx)
if err != nil {
Fatalf("Failed to register the Quai service: %v", err)
}
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index 7fb286e7f8..d195c84029 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -19,12 +19,12 @@ import (
"github.com/dominant-strategies/go-quai/common/fdlimit"
"github.com/dominant-strategies/go-quai/core"
"github.com/dominant-strategies/go-quai/core/rawdb"
- "github.com/dominant-strategies/go-quai/eth/ethconfig"
- "github.com/dominant-strategies/go-quai/eth/gasprice"
"github.com/dominant-strategies/go-quai/ethdb"
"github.com/dominant-strategies/go-quai/log"
"github.com/dominant-strategies/go-quai/node"
"github.com/dominant-strategies/go-quai/params"
+ "github.com/dominant-strategies/go-quai/quai/gasprice"
+ "github.com/dominant-strategies/go-quai/quai/quaiconfig"
"github.com/pelletier/go-toml/v2"
gopsutil "github.com/shirou/gopsutil/mem"
"github.com/spf13/cobra"
@@ -852,7 +852,7 @@ func setWS(cfg *node.Config, nodeLocation common.Location) {
}
// setDomUrl sets the dominant chain websocket url.
-func setDomUrl(cfg *ethconfig.Config, nodeLocation common.Location) {
+func setDomUrl(cfg *quaiconfig.Config, nodeLocation common.Location) {
// only set the dom url if the node is not prime
if nodeLocation != nil {
if len(nodeLocation) == 1 {
@@ -865,7 +865,7 @@ func setDomUrl(cfg *ethconfig.Config, nodeLocation common.Location) {
}
// setSubUrls sets the subordinate chain urls
-func setSubUrls(cfg *ethconfig.Config, nodeLocation common.Location) {
+func setSubUrls(cfg *quaiconfig.Config, nodeLocation common.Location) {
// only set the sub urls if its not the zone
if len(nodeLocation) != 2 {
if nodeLocation == nil {
@@ -878,7 +878,7 @@ func setSubUrls(cfg *ethconfig.Config, nodeLocation common.Location) {
// setGasLimitCeil sets the gas limit ceils based on the network that is
// running
-func setGasLimitCeil(cfg *ethconfig.Config) {
+func setGasLimitCeil(cfg *quaiconfig.Config) {
switch {
case viper.GetBool(ColosseumFlag.Name):
cfg.Miner.GasCeil = params.ColosseumGasCeil
@@ -903,7 +903,7 @@ func makeSubUrls() []string {
}
// setSlicesRunning sets the slices running flag
-func setSlicesRunning(cfg *ethconfig.Config) {
+func setSlicesRunning(cfg *quaiconfig.Config) {
slices := strings.Split(viper.GetString(SlicesRunningFlag.Name), ",")
// Sanity checks
@@ -946,7 +946,7 @@ func HexAddress(account string, nodeLocation common.Location) (common.Address, e
// setEtherbase retrieves the etherbase either from the directly specified
// command line flags or from the keystore if CLI indexed.
-func setEtherbase(cfg *ethconfig.Config) {
+func setEtherbase(cfg *quaiconfig.Config) {
coinbaseMap, err := ParseCoinbaseAddresses()
if err != nil {
log.Fatalf("error parsing coinbase addresses: %s", err)
@@ -1102,7 +1102,7 @@ func setTxPool(cfg *core.TxPoolConfig, nodeLocation common.Location) {
}
}
-func setConsensusEngineConfig(cfg *ethconfig.Config) {
+func setConsensusEngineConfig(cfg *quaiconfig.Config) {
if cfg.ConsensusEngine == "blake3" {
// Override any default configs for hard coded networks.
switch {
@@ -1173,7 +1173,7 @@ func setConsensusEngineConfig(cfg *ethconfig.Config) {
}
}
-func setWhitelist(cfg *ethconfig.Config) {
+func setWhitelist(cfg *quaiconfig.Config) {
whitelist := viper.GetString(WhitelistFlag.Name)
if whitelist == "" {
return
@@ -1235,8 +1235,8 @@ func CheckExclusive(args ...interface{}) {
}
}
-// SetQuaiConfig applies eth-related command line flags to the config.
-func SetQuaiConfig(stack *node.Node, cfg *ethconfig.Config, nodeLocation common.Location) {
+// SetQuaiConfig applies quai-related command line flags to the config.
+func SetQuaiConfig(stack *node.Node, cfg *quaiconfig.Config, nodeLocation common.Location) {
// Avoid conflicting network flags
CheckExclusive(ColosseumFlag, DeveloperFlag, GardenFlag, OrchardFlag, LocalFlag, LighthouseFlag)
CheckExclusive(DeveloperFlag, ExternalSignerFlag) // Can't use both ephemeral unlocked and external signer
diff --git a/internal/quaiapi/api.go b/internal/quaiapi/api.go
index c3a99e1300..23ed6bceb0 100644
--- a/internal/quaiapi/api.go
+++ b/internal/quaiapi/api.go
@@ -35,9 +35,9 @@ import (
"github.com/dominant-strategies/go-quai/core/types"
"github.com/dominant-strategies/go-quai/core/vm"
"github.com/dominant-strategies/go-quai/crypto"
- "github.com/dominant-strategies/go-quai/eth/abi"
"github.com/dominant-strategies/go-quai/log"
"github.com/dominant-strategies/go-quai/params"
+ "github.com/dominant-strategies/go-quai/quai/abi"
"github.com/dominant-strategies/go-quai/rlp"
"github.com/dominant-strategies/go-quai/rpc"
)
diff --git a/p2p/node/api.go b/p2p/node/api.go
index 3dd5157afe..48fb5fcba4 100644
--- a/p2p/node/api.go
+++ b/p2p/node/api.go
@@ -9,10 +9,10 @@ import (
"github.com/dominant-strategies/go-quai/cmd/utils"
"github.com/dominant-strategies/go-quai/core/types"
- "github.com/dominant-strategies/go-quai/eth"
"github.com/dominant-strategies/go-quai/log"
"github.com/dominant-strategies/go-quai/p2p"
quaiprotocol "github.com/dominant-strategies/go-quai/p2p/protocol"
+ "github.com/dominant-strategies/go-quai/quai"
"github.com/dominant-strategies/go-quai/common"
pubsub "github.com/libp2p/go-libp2p-pubsub"
@@ -94,7 +94,7 @@ func (p *P2PNode) Stop() error {
}
}
-func (p *P2PNode) SetConsensusBackend(be eth.ConsensusAPI) {
+func (p *P2PNode) SetConsensusBackend(be quai.ConsensusAPI) {
p.consensus = be
}
diff --git a/p2p/node/node.go b/p2p/node/node.go
index e7aaac2338..c5437ac967 100644
--- a/p2p/node/node.go
+++ b/p2p/node/node.go
@@ -22,10 +22,10 @@ import (
"github.com/dominant-strategies/go-quai/cmd/utils"
"github.com/dominant-strategies/go-quai/common"
"github.com/dominant-strategies/go-quai/core/types"
- "github.com/dominant-strategies/go-quai/eth"
"github.com/dominant-strategies/go-quai/log"
"github.com/dominant-strategies/go-quai/p2p/protocol"
"github.com/dominant-strategies/go-quai/p2p/pubsubManager"
+ "github.com/dominant-strategies/go-quai/quai"
lru "github.com/hashicorp/golang-lru/v2"
)
@@ -35,7 +35,7 @@ type P2PNode struct {
host.Host
// Backend for handling consensus data
- consensus eth.ConsensusAPI
+ consensus quai.ConsensusAPI
// List of peers to introduce us to the network
bootpeers []peer.AddrInfo
diff --git a/eth/abi/abi.go b/quai/abi/abi.go
similarity index 100%
rename from eth/abi/abi.go
rename to quai/abi/abi.go
diff --git a/eth/abi/abi_test.go b/quai/abi/abi_test.go
similarity index 100%
rename from eth/abi/abi_test.go
rename to quai/abi/abi_test.go
diff --git a/eth/abi/argument.go b/quai/abi/argument.go
similarity index 100%
rename from eth/abi/argument.go
rename to quai/abi/argument.go
diff --git a/eth/abi/doc.go b/quai/abi/doc.go
similarity index 100%
rename from eth/abi/doc.go
rename to quai/abi/doc.go
diff --git a/eth/abi/error.go b/quai/abi/error.go
similarity index 100%
rename from eth/abi/error.go
rename to quai/abi/error.go
diff --git a/eth/abi/event.go b/quai/abi/event.go
similarity index 100%
rename from eth/abi/event.go
rename to quai/abi/event.go
diff --git a/eth/abi/event_test.go b/quai/abi/event_test.go
similarity index 100%
rename from eth/abi/event_test.go
rename to quai/abi/event_test.go
diff --git a/eth/abi/method.go b/quai/abi/method.go
similarity index 100%
rename from eth/abi/method.go
rename to quai/abi/method.go
diff --git a/eth/abi/method_test.go b/quai/abi/method_test.go
similarity index 100%
rename from eth/abi/method_test.go
rename to quai/abi/method_test.go
diff --git a/eth/abi/pack.go b/quai/abi/pack.go
similarity index 100%
rename from eth/abi/pack.go
rename to quai/abi/pack.go
diff --git a/eth/abi/pack_test.go b/quai/abi/pack_test.go
similarity index 100%
rename from eth/abi/pack_test.go
rename to quai/abi/pack_test.go
diff --git a/eth/abi/packing_test.go b/quai/abi/packing_test.go
similarity index 100%
rename from eth/abi/packing_test.go
rename to quai/abi/packing_test.go
diff --git a/eth/abi/reflect.go b/quai/abi/reflect.go
similarity index 100%
rename from eth/abi/reflect.go
rename to quai/abi/reflect.go
diff --git a/eth/abi/reflect_test.go b/quai/abi/reflect_test.go
similarity index 100%
rename from eth/abi/reflect_test.go
rename to quai/abi/reflect_test.go
diff --git a/eth/abi/topics.go b/quai/abi/topics.go
similarity index 100%
rename from eth/abi/topics.go
rename to quai/abi/topics.go
diff --git a/eth/abi/topics_test.go b/quai/abi/topics_test.go
similarity index 100%
rename from eth/abi/topics_test.go
rename to quai/abi/topics_test.go
diff --git a/eth/abi/type.go b/quai/abi/type.go
similarity index 100%
rename from eth/abi/type.go
rename to quai/abi/type.go
diff --git a/eth/abi/type_test.go b/quai/abi/type_test.go
similarity index 100%
rename from eth/abi/type_test.go
rename to quai/abi/type_test.go
diff --git a/eth/abi/unpack.go b/quai/abi/unpack.go
similarity index 100%
rename from eth/abi/unpack.go
rename to quai/abi/unpack.go
diff --git a/eth/abi/unpack_test.go b/quai/abi/unpack_test.go
similarity index 100%
rename from eth/abi/unpack_test.go
rename to quai/abi/unpack_test.go
diff --git a/eth/api.go b/quai/api.go
similarity index 88%
rename from eth/api.go
rename to quai/api.go
index 90b5242bc8..90aeb3e293 100644
--- a/eth/api.go
+++ b/quai/api.go
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see .
-package eth
+package quai
import (
"compress/gzip"
@@ -125,13 +125,13 @@ func (api *PrivateMinerAPI) SetRecommitInterval(interval int) {
// PrivateAdminAPI is the collection of Quai full node-related APIs
// exposed over the private admin endpoint.
type PrivateAdminAPI struct {
- eth *Quai
+ quai *Quai
}
// NewPrivateAdminAPI creates a new API definition for the full node private
// admin methods of the Quai service.
-func NewPrivateAdminAPI(eth *Quai) *PrivateAdminAPI {
- return &PrivateAdminAPI{eth: eth}
+func NewPrivateAdminAPI(quai *Quai) *PrivateAdminAPI {
+ return &PrivateAdminAPI{quai: quai}
}
// ExportChain exports the current blockchain into a local file,
@@ -141,7 +141,7 @@ func (api *PrivateAdminAPI) ExportChain(file string, first *uint64, last *uint64
return false, errors.New("last cannot be specified without first")
}
if first != nil && last == nil {
- head := api.eth.Core().CurrentHeader().NumberU64(api.eth.core.NodeCtx())
+ head := api.quai.Core().CurrentHeader().NumberU64(api.quai.core.NodeCtx())
last = &head
}
if _, err := os.Stat(file); err == nil {
@@ -164,10 +164,10 @@ func (api *PrivateAdminAPI) ExportChain(file string, first *uint64, last *uint64
// Export the blockchain
if first != nil {
- if err := api.eth.Core().ExportN(writer, *first, *last); err != nil {
+ if err := api.quai.Core().ExportN(writer, *first, *last); err != nil {
return false, err
}
- } else if err := api.eth.Core().Export(writer); err != nil {
+ } else if err := api.quai.Core().Export(writer); err != nil {
return false, err
}
return true, nil
@@ -218,12 +218,12 @@ func (api *PrivateAdminAPI) ImportChain(file string) (bool, error) {
break
}
- if hasAllBlocks(api.eth.Core(), blocks) {
+ if hasAllBlocks(api.quai.Core(), blocks) {
blocks = blocks[:0]
continue
}
// Import the batch and reset the buffer
- if _, err := api.eth.Core().InsertChain(blocks); err != nil {
+ if _, err := api.quai.Core().InsertChain(blocks); err != nil {
return false, fmt.Errorf("batch %d: failed to insert: %v", batch, err)
}
blocks = blocks[:0]
@@ -234,13 +234,13 @@ func (api *PrivateAdminAPI) ImportChain(file string) (bool, error) {
// PublicDebugAPI is the collection of Quai full node APIs exposed
// over the public debugging endpoint.
type PublicDebugAPI struct {
- eth *Quai
+ quai *Quai
}
// NewPublicDebugAPI creates a new API definition for the full node-
// related public debug methods of the Quai service.
-func NewPublicDebugAPI(eth *Quai) *PublicDebugAPI {
- return &PublicDebugAPI{eth: eth}
+func NewPublicDebugAPI(quai *Quai) *PublicDebugAPI {
+ return &PublicDebugAPI{quai: quai}
}
// DumpBlock retrieves the entire state of the database at a given block.
@@ -254,14 +254,14 @@ func (api *PublicDebugAPI) DumpBlock(blockNr rpc.BlockNumber) (state.Dump, error
}
var block *types.Block
if blockNr == rpc.LatestBlockNumber {
- block = api.eth.core.CurrentBlock()
+ block = api.quai.core.CurrentBlock()
} else {
- block = api.eth.core.GetBlockByNumber(uint64(blockNr))
+ block = api.quai.core.GetBlockByNumber(uint64(blockNr))
}
if block == nil {
return state.Dump{}, fmt.Errorf("block #%d not found", blockNr)
}
- stateDb, err := api.eth.core.StateAt(block.Root())
+ stateDb, err := api.quai.core.StateAt(block.Root())
if err != nil {
return state.Dump{}, err
}
@@ -271,18 +271,18 @@ func (api *PublicDebugAPI) DumpBlock(blockNr rpc.BlockNumber) (state.Dump, error
// PrivateDebugAPI is the collection of Quai full node APIs exposed over
// the private debugging endpoint.
type PrivateDebugAPI struct {
- eth *Quai
+ quai *Quai
}
// NewPrivateDebugAPI creates a new API definition for the full node-related
// private debug methods of the Quai service.
-func NewPrivateDebugAPI(eth *Quai) *PrivateDebugAPI {
- return &PrivateDebugAPI{eth: eth}
+func NewPrivateDebugAPI(quai *Quai) *PrivateDebugAPI {
+ return &PrivateDebugAPI{quai: quai}
}
// Preimage is a debug API function that returns the preimage for a sha3 hash, if known.
func (api *PrivateDebugAPI) Preimage(ctx context.Context, hash common.Hash) (hexutil.Bytes, error) {
- if preimage := rawdb.ReadPreimage(api.eth.ChainDb(), hash); preimage != nil {
+ if preimage := rawdb.ReadPreimage(api.quai.ChainDb(), hash); preimage != nil {
return preimage, nil
}
return nil, errors.New("unknown preimage")
@@ -300,7 +300,7 @@ type BadBlockArgs struct {
func (api *PrivateDebugAPI) GetBadBlocks(ctx context.Context) ([]*BadBlockArgs, error) {
var (
err error
- blocks = rawdb.ReadAllBadBlocks(api.eth.chainDb)
+ blocks = rawdb.ReadAllBadBlocks(api.quai.chainDb)
results = make([]*BadBlockArgs, 0, len(blocks))
)
for _, block := range blocks {
@@ -313,7 +313,7 @@ func (api *PrivateDebugAPI) GetBadBlocks(ctx context.Context) ([]*BadBlockArgs,
} else {
blockRlp = fmt.Sprintf("0x%x", rlpBytes)
}
- if blockJSON, err = quaiapi.RPCMarshalBlock(block, true, true, api.eth.core.NodeLocation()); err != nil {
+ if blockJSON, err = quaiapi.RPCMarshalBlock(block, true, true, api.quai.core.NodeLocation()); err != nil {
blockJSON = map[string]interface{}{"error": err.Error()}
}
results = append(results, &BadBlockArgs{
@@ -342,24 +342,24 @@ func (api *PublicDebugAPI) AccountRange(blockNrOrHash rpc.BlockNumberOrHash, sta
} else {
var block *types.Block
if number == rpc.LatestBlockNumber {
- block = api.eth.core.CurrentBlock()
+ block = api.quai.core.CurrentBlock()
} else {
- block = api.eth.core.GetBlockByNumber(uint64(number))
+ block = api.quai.core.GetBlockByNumber(uint64(number))
}
if block == nil {
return state.IteratorDump{}, fmt.Errorf("block #%d not found", number)
}
- stateDb, err = api.eth.core.StateAt(block.Root())
+ stateDb, err = api.quai.core.StateAt(block.Root())
if err != nil {
return state.IteratorDump{}, err
}
}
} else if hash, ok := blockNrOrHash.Hash(); ok {
- block := api.eth.core.GetBlockByHash(hash)
+ block := api.quai.core.GetBlockByHash(hash)
if block == nil {
return state.IteratorDump{}, fmt.Errorf("block %s not found", hash.Hex())
}
- stateDb, err = api.eth.core.StateAt(block.Root())
+ stateDb, err = api.quai.core.StateAt(block.Root())
if err != nil {
return state.IteratorDump{}, err
}
@@ -396,11 +396,11 @@ type storageEntry struct {
// StorageRangeAt returns the storage at the given block height and transaction index.
func (api *PrivateDebugAPI) StorageRangeAt(blockHash common.Hash, txIndex int, contractAddress common.Address, keyStart hexutil.Bytes, maxResult int) (StorageRangeResult, error) {
// Retrieve the block
- block := api.eth.core.GetBlockByHash(blockHash)
+ block := api.quai.core.GetBlockByHash(blockHash)
if block == nil {
return StorageRangeResult{}, fmt.Errorf("block %#x not found", blockHash)
}
- _, _, statedb, err := api.eth.core.StateAtTransaction(block, txIndex, 0)
+ _, _, statedb, err := api.quai.core.StateAtTransaction(block, txIndex, 0)
if err != nil {
return StorageRangeResult{}, err
}
@@ -446,20 +446,20 @@ func storageRangeAt(st state.Trie, start []byte, maxResult int) (StorageRangeRes
func (api *PrivateDebugAPI) GetModifiedAccountsByNumber(startNum uint64, endNum *uint64) ([]common.Address, error) {
var startBlock, endBlock *types.Block
- startBlock = api.eth.core.GetBlockByNumber(startNum)
+ startBlock = api.quai.core.GetBlockByNumber(startNum)
if startBlock == nil {
return nil, fmt.Errorf("start block %x not found", startNum)
}
- nodeCtx := api.eth.core.NodeCtx()
+ nodeCtx := api.quai.core.NodeCtx()
if endNum == nil {
endBlock = startBlock
- startBlock = api.eth.core.GetBlockByHash(startBlock.ParentHash(nodeCtx))
+ startBlock = api.quai.core.GetBlockByHash(startBlock.ParentHash(nodeCtx))
if startBlock == nil {
return nil, fmt.Errorf("block %x has no parent", endBlock.Number(nodeCtx))
}
} else {
- endBlock = api.eth.core.GetBlockByNumber(*endNum)
+ endBlock = api.quai.core.GetBlockByNumber(*endNum)
if endBlock == nil {
return nil, fmt.Errorf("end block %d not found", *endNum)
}
@@ -474,20 +474,20 @@ func (api *PrivateDebugAPI) GetModifiedAccountsByNumber(startNum uint64, endNum
// With one parameter, returns the list of accounts modified in the specified block.
func (api *PrivateDebugAPI) GetModifiedAccountsByHash(startHash common.Hash, endHash *common.Hash) ([]common.Address, error) {
var startBlock, endBlock *types.Block
- startBlock = api.eth.core.GetBlockByHash(startHash)
+ startBlock = api.quai.core.GetBlockByHash(startHash)
if startBlock == nil {
return nil, fmt.Errorf("start block %x not found", startHash)
}
- nodeCtx := api.eth.core.NodeCtx()
+ nodeCtx := api.quai.core.NodeCtx()
if endHash == nil {
endBlock = startBlock
- startBlock = api.eth.core.GetBlockByHash(startBlock.ParentHash(nodeCtx))
+ startBlock = api.quai.core.GetBlockByHash(startBlock.ParentHash(nodeCtx))
if startBlock == nil {
return nil, fmt.Errorf("block %x has no parent", endBlock.Number(nodeCtx))
}
} else {
- endBlock = api.eth.core.GetBlockByHash(*endHash)
+ endBlock = api.quai.core.GetBlockByHash(*endHash)
if endBlock == nil {
return nil, fmt.Errorf("end block %x not found", *endHash)
}
@@ -496,12 +496,12 @@ func (api *PrivateDebugAPI) GetModifiedAccountsByHash(startHash common.Hash, end
}
func (api *PrivateDebugAPI) getModifiedAccounts(startBlock, endBlock *types.Block) ([]common.Address, error) {
- nodeLocation := api.eth.core.NodeLocation()
- nodeCtx := api.eth.core.NodeCtx()
+ nodeLocation := api.quai.core.NodeLocation()
+ nodeCtx := api.quai.core.NodeCtx()
if startBlock.NumberU64(nodeCtx) >= endBlock.NumberU64(nodeCtx) {
return nil, fmt.Errorf("start block height (%d) must be less than end block height (%d)", startBlock.NumberU64(nodeCtx), endBlock.NumberU64(nodeCtx))
}
- triedb := api.eth.Core().StateCache().TrieDB()
+ triedb := api.quai.Core().StateCache().TrieDB()
oldTrie, err := trie.NewSecure(startBlock.Root(), triedb)
if err != nil {
diff --git a/eth/api_backend.go b/quai/api_backend.go
similarity index 74%
rename from eth/api_backend.go
rename to quai/api_backend.go
index f22c6b811f..803bf8b8e1 100644
--- a/eth/api_backend.go
+++ b/quai/api_backend.go
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see .
-package eth
+package quai
import (
"context"
@@ -29,71 +29,71 @@ import (
"github.com/dominant-strategies/go-quai/core/state"
"github.com/dominant-strategies/go-quai/core/types"
"github.com/dominant-strategies/go-quai/core/vm"
- "github.com/dominant-strategies/go-quai/eth/gasprice"
"github.com/dominant-strategies/go-quai/ethdb"
"github.com/dominant-strategies/go-quai/event"
"github.com/dominant-strategies/go-quai/params"
+ "github.com/dominant-strategies/go-quai/quai/gasprice"
"github.com/dominant-strategies/go-quai/rpc"
)
// QuaiAPIBackend implements quaiapi.Backend for full nodes
type QuaiAPIBackend struct {
extRPCEnabled bool
- eth *Quai
+ quai *Quai
gpo *gasprice.Oracle
}
// ChainConfig returns the active chain configuration.
func (b *QuaiAPIBackend) ChainConfig() *params.ChainConfig {
- return b.eth.core.Config()
+ return b.quai.core.Config()
}
func (b *QuaiAPIBackend) TxPool() *core.TxPool {
- nodeCtx := b.eth.core.NodeCtx()
+ nodeCtx := b.quai.core.NodeCtx()
if nodeCtx != common.ZONE_CTX {
return nil
}
- return b.eth.core.TxPool()
+ return b.quai.core.TxPool()
}
func (b *QuaiAPIBackend) NodeLocation() common.Location {
- return b.eth.core.NodeLocation()
+ return b.quai.core.NodeLocation()
}
func (b *QuaiAPIBackend) NodeCtx() int {
- return b.eth.core.NodeCtx()
+ return b.quai.core.NodeCtx()
}
func (b *QuaiAPIBackend) CurrentBlock() *types.Block {
- return b.eth.core.CurrentBlock()
+ return b.quai.core.CurrentBlock()
}
// CurrentLogEntropy returns the logarithm of the total entropy reduction since genesis for our current head block
func (b *QuaiAPIBackend) CurrentLogEntropy() *big.Int {
- return b.eth.core.CurrentLogEntropy()
+ return b.quai.core.CurrentLogEntropy()
}
// TotalLogS returns the total entropy reduction if the chain since genesis to the given header
func (b *QuaiAPIBackend) TotalLogS(header *types.Header) *big.Int {
- return b.eth.core.TotalLogS(header)
+ return b.quai.core.TotalLogS(header)
}
// CalcOrder returns the order of the block within the hierarchy of chains
func (b *QuaiAPIBackend) CalcOrder(header *types.Header) (*big.Int, int, error) {
- return b.eth.core.CalcOrder(header)
+ return b.quai.core.CalcOrder(header)
}
func (b *QuaiAPIBackend) HeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Header, error) {
// Pending block is only known by the miner
if number == rpc.PendingBlockNumber {
- block := b.eth.core.PendingBlock()
+ block := b.quai.core.PendingBlock()
return block.Header(), nil
}
// Otherwise resolve and return the block
if number == rpc.LatestBlockNumber {
- return b.eth.core.CurrentBlock().Header(), nil
+ return b.quai.core.CurrentBlock().Header(), nil
}
- return b.eth.core.GetHeaderByNumber(uint64(number)), nil
+ return b.quai.core.GetHeaderByNumber(uint64(number)), nil
}
func (b *QuaiAPIBackend) HeaderByNumberOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (*types.Header, error) {
@@ -101,11 +101,11 @@ func (b *QuaiAPIBackend) HeaderByNumberOrHash(ctx context.Context, blockNrOrHash
return b.HeaderByNumber(ctx, blockNr)
}
if hash, ok := blockNrOrHash.Hash(); ok {
- header := b.eth.core.GetHeaderByHash(hash)
+ header := b.quai.core.GetHeaderByHash(hash)
if header == nil {
return nil, errors.New("header for hash not found")
}
- if blockNrOrHash.RequireCanonical && b.eth.core.GetCanonicalHash(header.NumberU64(b.NodeCtx())) != hash {
+ if blockNrOrHash.RequireCanonical && b.quai.core.GetCanonicalHash(header.NumberU64(b.NodeCtx())) != hash {
return nil, errors.New("hash is not currently canonical")
}
return header, nil
@@ -114,20 +114,20 @@ func (b *QuaiAPIBackend) HeaderByNumberOrHash(ctx context.Context, blockNrOrHash
}
func (b *QuaiAPIBackend) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error) {
- return b.eth.core.GetHeaderByHash(hash), nil
+ return b.quai.core.GetHeaderByHash(hash), nil
}
func (b *QuaiAPIBackend) BlockByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Block, error) {
// Pending block is only known by the miner
if number == rpc.PendingBlockNumber {
- block := b.eth.core.PendingBlock()
+ block := b.quai.core.PendingBlock()
return block, nil
}
// Otherwise resolve and return the block
if number == rpc.LatestBlockNumber {
- number = rpc.BlockNumber(b.eth.core.CurrentHeader().NumberU64(b.NodeCtx()))
+ number = rpc.BlockNumber(b.quai.core.CurrentHeader().NumberU64(b.NodeCtx()))
}
- block := b.eth.core.GetBlockByNumber(uint64(number))
+ block := b.quai.core.GetBlockByNumber(uint64(number))
if block != nil {
return block, nil
}
@@ -135,7 +135,7 @@ func (b *QuaiAPIBackend) BlockByNumber(ctx context.Context, number rpc.BlockNumb
}
func (b *QuaiAPIBackend) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error) {
- return b.eth.core.GetBlockByHash(hash), nil
+ return b.quai.core.GetBlockByHash(hash), nil
}
func (b *QuaiAPIBackend) BlockByNumberOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (*types.Block, error) {
@@ -143,14 +143,14 @@ func (b *QuaiAPIBackend) BlockByNumberOrHash(ctx context.Context, blockNrOrHash
return b.BlockByNumber(ctx, blockNr)
}
if hash, ok := blockNrOrHash.Hash(); ok {
- header := b.eth.core.GetHeaderByHash(hash)
+ header := b.quai.core.GetHeaderByHash(hash)
if header == nil {
return nil, errors.New("header for hash not found")
}
- if blockNrOrHash.RequireCanonical && b.eth.core.GetCanonicalHash(header.NumberU64(b.NodeCtx())) != hash {
+ if blockNrOrHash.RequireCanonical && b.quai.core.GetCanonicalHash(header.NumberU64(b.NodeCtx())) != hash {
return nil, errors.New("hash is not currently canonical")
}
- block := b.eth.core.GetBlock(hash, header.NumberU64(b.NodeCtx()))
+ block := b.quai.core.GetBlock(hash, header.NumberU64(b.NodeCtx()))
if block == nil {
return nil, errors.New("header found, but block body is missing")
}
@@ -160,17 +160,17 @@ func (b *QuaiAPIBackend) BlockByNumberOrHash(ctx context.Context, blockNrOrHash
}
func (b *QuaiAPIBackend) PendingBlockAndReceipts() (*types.Block, types.Receipts) {
- return b.eth.core.PendingBlockAndReceipts()
+ return b.quai.core.PendingBlockAndReceipts()
}
func (b *QuaiAPIBackend) StateAndHeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*state.StateDB, *types.Header, error) {
- nodeCtx := b.eth.core.NodeCtx()
+ nodeCtx := b.quai.core.NodeCtx()
if nodeCtx != common.ZONE_CTX {
return nil, nil, errors.New("stateAndHeaderByNumber can only be called in zone chain")
}
// Pending state is only known by the miner
if number == rpc.PendingBlockNumber {
- block := b.eth.core.Pending()
+ block := b.quai.core.Pending()
return &state.StateDB{}, block.Header(), nil
}
// Otherwise resolve the block number and return its state
@@ -181,12 +181,12 @@ func (b *QuaiAPIBackend) StateAndHeaderByNumber(ctx context.Context, number rpc.
if header == nil {
return nil, nil, errors.New("header not found")
}
- stateDb, err := b.eth.Core().StateAt(header.Root())
+ stateDb, err := b.quai.Core().StateAt(header.Root())
return stateDb, header, err
}
func (b *QuaiAPIBackend) StateAndHeaderByNumberOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (*state.StateDB, *types.Header, error) {
- nodeCtx := b.eth.core.NodeCtx()
+ nodeCtx := b.quai.core.NodeCtx()
if nodeCtx != common.ZONE_CTX {
return nil, nil, errors.New("stateAndHeaderByNumberOrHash can only be called in zone chain")
}
@@ -201,38 +201,38 @@ func (b *QuaiAPIBackend) StateAndHeaderByNumberOrHash(ctx context.Context, block
if header == nil {
return nil, nil, errors.New("header for hash not found")
}
- if blockNrOrHash.RequireCanonical && b.eth.core.GetCanonicalHash(header.NumberU64(b.NodeCtx())) != hash {
+ if blockNrOrHash.RequireCanonical && b.quai.core.GetCanonicalHash(header.NumberU64(b.NodeCtx())) != hash {
return nil, nil, errors.New("hash is not currently canonical")
}
- stateDb, err := b.eth.Core().StateAt(header.Root())
+ stateDb, err := b.quai.Core().StateAt(header.Root())
return stateDb, header, err
}
return nil, nil, errors.New("invalid arguments; neither block nor hash specified")
}
func (b *QuaiAPIBackend) GetReceipts(ctx context.Context, hash common.Hash) (types.Receipts, error) {
- nodeCtx := b.eth.core.NodeCtx()
+ nodeCtx := b.quai.core.NodeCtx()
if nodeCtx != common.ZONE_CTX {
return nil, errors.New("getReceipts can only be called in zone chain")
}
- return b.eth.core.GetReceiptsByHash(hash), nil
+ return b.quai.core.GetReceiptsByHash(hash), nil
}
// GetBloom returns the bloom for the given block hash
func (b *QuaiAPIBackend) GetBloom(hash common.Hash) (*types.Bloom, error) {
- nodeCtx := b.eth.core.NodeCtx()
+ nodeCtx := b.quai.core.NodeCtx()
if nodeCtx != common.ZONE_CTX {
return nil, errors.New("getBloom can only be called in zone chain")
}
- return b.eth.core.Slice().HeaderChain().GetBloom(hash)
+ return b.quai.core.Slice().HeaderChain().GetBloom(hash)
}
func (b *QuaiAPIBackend) GetLogs(ctx context.Context, hash common.Hash) ([][]*types.Log, error) {
- nodeCtx := b.eth.core.NodeCtx()
+ nodeCtx := b.quai.core.NodeCtx()
if nodeCtx != common.ZONE_CTX {
return nil, errors.New("getLogs can only be called in zone chain")
}
- receipts := b.eth.core.GetReceiptsByHash(hash)
+ receipts := b.quai.core.GetReceiptsByHash(hash)
if receipts == nil {
return nil, nil
}
@@ -245,68 +245,68 @@ func (b *QuaiAPIBackend) GetLogs(ctx context.Context, hash common.Hash) ([][]*ty
func (b *QuaiAPIBackend) GetEVM(ctx context.Context, msg core.Message, state *state.StateDB, header *types.Header, vmConfig *vm.Config) (*vm.EVM, func() error, error) {
vmError := func() error { return nil }
- nodeCtx := b.eth.core.NodeCtx()
+ nodeCtx := b.quai.core.NodeCtx()
if nodeCtx != common.ZONE_CTX {
return nil, vmError, errors.New("getEvm can only be called in zone chain")
}
if vmConfig == nil {
- vmConfig = b.eth.core.GetVMConfig()
+ vmConfig = b.quai.core.GetVMConfig()
}
txContext := core.NewEVMTxContext(msg)
- context := core.NewEVMBlockContext(header, b.eth.Core(), nil)
- return vm.NewEVM(context, txContext, state, b.eth.core.Config(), *vmConfig), vmError, nil
+ context := core.NewEVMBlockContext(header, b.quai.Core(), nil)
+ return vm.NewEVM(context, txContext, state, b.quai.core.Config(), *vmConfig), vmError, nil
}
func (b *QuaiAPIBackend) SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent) event.Subscription {
- nodeCtx := b.eth.core.NodeCtx()
+ nodeCtx := b.quai.core.NodeCtx()
if nodeCtx != common.ZONE_CTX {
return nil
}
- return b.eth.Core().SubscribeRemovedLogsEvent(ch)
+ return b.quai.Core().SubscribeRemovedLogsEvent(ch)
}
func (b *QuaiAPIBackend) SubscribePendingLogsEvent(ch chan<- []*types.Log) event.Subscription {
- nodeCtx := b.eth.core.NodeCtx()
+ nodeCtx := b.quai.core.NodeCtx()
if nodeCtx != common.ZONE_CTX {
return nil
}
- return b.eth.core.SubscribePendingLogs(ch)
+ return b.quai.core.SubscribePendingLogs(ch)
}
func (b *QuaiAPIBackend) SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscription {
- return b.eth.Core().SubscribeChainEvent(ch)
+ return b.quai.Core().SubscribeChainEvent(ch)
}
func (b *QuaiAPIBackend) SubscribeChainHeadEvent(ch chan<- core.ChainHeadEvent) event.Subscription {
- return b.eth.Core().SubscribeChainHeadEvent(ch)
+ return b.quai.Core().SubscribeChainHeadEvent(ch)
}
func (b *QuaiAPIBackend) SubscribeChainSideEvent(ch chan<- core.ChainSideEvent) event.Subscription {
- return b.eth.Core().SubscribeChainSideEvent(ch)
+ return b.quai.Core().SubscribeChainSideEvent(ch)
}
func (b *QuaiAPIBackend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription {
- nodeCtx := b.eth.core.NodeCtx()
+ nodeCtx := b.quai.core.NodeCtx()
if nodeCtx != common.ZONE_CTX {
return nil
}
- return b.eth.Core().SubscribeLogsEvent(ch)
+ return b.quai.Core().SubscribeLogsEvent(ch)
}
func (b *QuaiAPIBackend) SendTx(ctx context.Context, signedTx *types.Transaction) error {
- nodeCtx := b.eth.core.NodeCtx()
+ nodeCtx := b.quai.core.NodeCtx()
if nodeCtx != common.ZONE_CTX {
return errors.New("sendTx can only be called in zone chain")
}
- return b.eth.Core().AddLocal(signedTx)
+ return b.quai.Core().AddLocal(signedTx)
}
func (b *QuaiAPIBackend) GetPoolTransactions() (types.Transactions, error) {
- nodeCtx := b.eth.core.NodeCtx()
+ nodeCtx := b.quai.core.NodeCtx()
if nodeCtx != common.ZONE_CTX {
return nil, errors.New("getPoolTransactions can only be called in zone chain")
}
- pending, err := b.eth.core.TxPoolPending(false)
+ pending, err := b.quai.core.TxPoolPending(false)
if err != nil {
return nil, err
}
@@ -318,60 +318,60 @@ func (b *QuaiAPIBackend) GetPoolTransactions() (types.Transactions, error) {
}
func (b *QuaiAPIBackend) GetPoolTransaction(hash common.Hash) *types.Transaction {
- nodeCtx := b.eth.core.NodeCtx()
+ nodeCtx := b.quai.core.NodeCtx()
if nodeCtx != common.ZONE_CTX {
return nil
}
- return b.eth.core.Get(hash)
+ return b.quai.core.Get(hash)
}
func (b *QuaiAPIBackend) GetTransaction(ctx context.Context, txHash common.Hash) (*types.Transaction, common.Hash, uint64, uint64, error) {
- nodeCtx := b.eth.core.NodeCtx()
+ nodeCtx := b.quai.core.NodeCtx()
if nodeCtx != common.ZONE_CTX {
return nil, common.Hash{}, 0, 0, errors.New("getTransaction can only be called in zone chain")
}
- tx, blockHash, blockNumber, index := rawdb.ReadTransaction(b.eth.ChainDb(), txHash)
+ tx, blockHash, blockNumber, index := rawdb.ReadTransaction(b.quai.ChainDb(), txHash)
return tx, blockHash, blockNumber, index, nil
}
func (b *QuaiAPIBackend) GetPoolNonce(ctx context.Context, addr common.Address) (uint64, error) {
- nodeCtx := b.eth.core.NodeCtx()
+ nodeCtx := b.quai.core.NodeCtx()
if nodeCtx != common.ZONE_CTX {
return 0, errors.New("getPoolNonce can only be called in zone chain")
}
- return b.eth.core.Nonce(addr), nil
+ return b.quai.core.Nonce(addr), nil
}
func (b *QuaiAPIBackend) Stats() (pending int, queued int) {
- return b.eth.core.Stats()
+ return b.quai.core.Stats()
}
func (b *QuaiAPIBackend) TxPoolContent() (map[common.InternalAddress]types.Transactions, map[common.InternalAddress]types.Transactions) {
- nodeCtx := b.eth.core.NodeCtx()
+ nodeCtx := b.quai.core.NodeCtx()
if nodeCtx != common.ZONE_CTX {
return nil, nil
}
- return b.eth.core.Content()
+ return b.quai.core.Content()
}
func (b *QuaiAPIBackend) TxPoolContentFrom(addr common.Address) (types.Transactions, types.Transactions) {
- nodeCtx := b.eth.core.NodeCtx()
+ nodeCtx := b.quai.core.NodeCtx()
if nodeCtx != common.ZONE_CTX {
return nil, nil
}
- return b.eth.core.ContentFrom(addr)
+ return b.quai.core.ContentFrom(addr)
}
func (b *QuaiAPIBackend) SubscribeNewTxsEvent(ch chan<- core.NewTxsEvent) event.Subscription {
- nodeCtx := b.eth.core.NodeCtx()
+ nodeCtx := b.quai.core.NodeCtx()
if nodeCtx != common.ZONE_CTX {
return nil
}
- return b.eth.core.SubscribeNewTxsEvent(ch)
+ return b.quai.core.SubscribeNewTxsEvent(ch)
}
func (b *QuaiAPIBackend) SuggestGasTipCap(ctx context.Context) (*big.Int, error) {
- nodeCtx := b.eth.core.NodeCtx()
+ nodeCtx := b.quai.core.NodeCtx()
if nodeCtx != common.ZONE_CTX {
return nil, errors.New("suggestTipCap can only be called in zone chain")
}
@@ -383,11 +383,11 @@ func (b *QuaiAPIBackend) FeeHistory(ctx context.Context, blockCount int, lastBlo
}
func (b *QuaiAPIBackend) ChainDb() ethdb.Database {
- return b.eth.ChainDb()
+ return b.quai.ChainDb()
}
func (b *QuaiAPIBackend) EventMux() *event.TypeMux {
- return b.eth.EventMux()
+ return b.quai.EventMux()
}
func (b *QuaiAPIBackend) ExtRPCEnabled() bool {
@@ -395,136 +395,136 @@ func (b *QuaiAPIBackend) ExtRPCEnabled() bool {
}
func (b *QuaiAPIBackend) RPCGasCap() uint64 {
- nodeCtx := b.eth.core.NodeCtx()
+ nodeCtx := b.quai.core.NodeCtx()
if nodeCtx != common.ZONE_CTX {
return 0
}
- return b.eth.config.RPCGasCap
+ return b.quai.config.RPCGasCap
}
func (b *QuaiAPIBackend) RPCTxFeeCap() float64 {
- nodeCtx := b.eth.core.NodeCtx()
+ nodeCtx := b.quai.core.NodeCtx()
if nodeCtx != common.ZONE_CTX {
return 0
}
- return b.eth.config.RPCTxFeeCap
+ return b.quai.config.RPCTxFeeCap
}
func (b *QuaiAPIBackend) BloomStatus() (uint64, uint64) {
- sections, _, _ := b.eth.bloomIndexer.Sections()
+ sections, _, _ := b.quai.bloomIndexer.Sections()
return params.BloomBitsBlocks, sections
}
func (b *QuaiAPIBackend) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession) {
for i := 0; i < bloomFilterThreads; i++ {
- go session.Multiplex(bloomRetrievalBatch, bloomRetrievalWait, b.eth.bloomRequests)
+ go session.Multiplex(bloomRetrievalBatch, bloomRetrievalWait, b.quai.bloomRequests)
}
}
func (b *QuaiAPIBackend) Engine() consensus.Engine {
- return b.eth.engine
+ return b.quai.engine
}
func (b *QuaiAPIBackend) CurrentHeader() *types.Header {
- return b.eth.core.CurrentHeader()
+ return b.quai.core.CurrentHeader()
}
func (b *QuaiAPIBackend) StateAtBlock(ctx context.Context, block *types.Block, reexec uint64, base *state.StateDB, checkLive bool) (*state.StateDB, error) {
- nodeCtx := b.eth.core.NodeCtx()
+ nodeCtx := b.quai.core.NodeCtx()
if nodeCtx != common.ZONE_CTX {
return nil, errors.New("stateAtBlock can only be called in zone chain")
}
- return b.eth.core.StateAtBlock(block, reexec, base, checkLive)
+ return b.quai.core.StateAtBlock(block, reexec, base, checkLive)
}
func (b *QuaiAPIBackend) StateAtTransaction(ctx context.Context, block *types.Block, txIndex int, reexec uint64) (core.Message, vm.BlockContext, *state.StateDB, error) {
- nodeCtx := b.eth.core.NodeCtx()
+ nodeCtx := b.quai.core.NodeCtx()
if nodeCtx != common.ZONE_CTX {
return nil, vm.BlockContext{}, nil, errors.New("stateAtTransaction can only be called in zone chain")
}
- return b.eth.core.StateAtTransaction(block, txIndex, reexec)
+ return b.quai.core.StateAtTransaction(block, txIndex, reexec)
}
func (b *QuaiAPIBackend) Append(header *types.Header, manifest types.BlockManifest, domPendingHeader *types.Header, domTerminus common.Hash, domOrigin bool, newInboundEtxs types.Transactions) (types.Transactions, bool, bool, error) {
- return b.eth.core.Append(header, manifest, domPendingHeader, domTerminus, domOrigin, newInboundEtxs)
+ return b.quai.core.Append(header, manifest, domPendingHeader, domTerminus, domOrigin, newInboundEtxs)
}
func (b *QuaiAPIBackend) DownloadBlocksInManifest(hash common.Hash, manifest types.BlockManifest, entropy *big.Int) {
- b.eth.core.DownloadBlocksInManifest(hash, manifest, entropy)
+ b.quai.core.DownloadBlocksInManifest(hash, manifest, entropy)
}
func (b *QuaiAPIBackend) ConstructLocalMinedBlock(header *types.Header) (*types.Block, error) {
- return b.eth.core.ConstructLocalMinedBlock(header)
+ return b.quai.core.ConstructLocalMinedBlock(header)
}
func (b *QuaiAPIBackend) InsertBlock(ctx context.Context, block *types.Block) (int, error) {
- return b.eth.core.InsertChain([]*types.Block{block})
+ return b.quai.core.InsertChain([]*types.Block{block})
}
func (b *QuaiAPIBackend) WriteBlock(block *types.Block) {
- b.eth.core.WriteBlock(block)
+ b.quai.core.WriteBlock(block)
}
func (b *QuaiAPIBackend) PendingBlock() *types.Block {
- return b.eth.core.PendingBlock()
+ return b.quai.core.PendingBlock()
}
func (b *QuaiAPIBackend) SubRelayPendingHeader(pendingHeader types.PendingHeader, newEntropy *big.Int, location common.Location, subReorg bool, order int) {
- b.eth.core.SubRelayPendingHeader(pendingHeader, newEntropy, location, subReorg, order)
+ b.quai.core.SubRelayPendingHeader(pendingHeader, newEntropy, location, subReorg, order)
}
func (b *QuaiAPIBackend) UpdateDom(oldTerminus common.Hash, pendingHeader types.PendingHeader, location common.Location) {
- b.eth.core.UpdateDom(oldTerminus, pendingHeader, location)
+ b.quai.core.UpdateDom(oldTerminus, pendingHeader, location)
}
func (b *QuaiAPIBackend) RequestDomToAppendOrFetch(hash common.Hash, entropy *big.Int, order int) {
- b.eth.core.RequestDomToAppendOrFetch(hash, entropy, order)
+ b.quai.core.RequestDomToAppendOrFetch(hash, entropy, order)
}
func (b *QuaiAPIBackend) ProcessingState() bool {
- return b.eth.core.ProcessingState()
+ return b.quai.core.ProcessingState()
}
func (b *QuaiAPIBackend) NewGenesisPendingHeader(pendingHeader *types.Header) {
- b.eth.core.NewGenesisPendigHeader(pendingHeader)
+ b.quai.core.NewGenesisPendigHeader(pendingHeader)
}
func (b *QuaiAPIBackend) GetPendingHeader() (*types.Header, error) {
- return b.eth.core.GetPendingHeader()
+ return b.quai.core.GetPendingHeader()
}
func (b *QuaiAPIBackend) GetManifest(blockHash common.Hash) (types.BlockManifest, error) {
- return b.eth.core.GetManifest(blockHash)
+ return b.quai.core.GetManifest(blockHash)
}
func (b *QuaiAPIBackend) GetSubManifest(slice common.Location, blockHash common.Hash) (types.BlockManifest, error) {
- return b.eth.core.GetSubManifest(slice, blockHash)
+ return b.quai.core.GetSubManifest(slice, blockHash)
}
func (b *QuaiAPIBackend) AddPendingEtxs(pEtxs types.PendingEtxs) error {
- return b.eth.core.AddPendingEtxs(pEtxs)
+ return b.quai.core.AddPendingEtxs(pEtxs)
}
func (b *QuaiAPIBackend) AddPendingEtxsRollup(pEtxsRollup types.PendingEtxsRollup) error {
- return b.eth.core.AddPendingEtxsRollup(pEtxsRollup)
+ return b.quai.core.AddPendingEtxsRollup(pEtxsRollup)
}
func (b *QuaiAPIBackend) SubscribePendingHeaderEvent(ch chan<- *types.Header) event.Subscription {
- return b.eth.core.SubscribePendingHeader(ch)
+ return b.quai.core.SubscribePendingHeader(ch)
}
func (b *QuaiAPIBackend) GenerateRecoveryPendingHeader(pendingHeader *types.Header, checkpointHashes types.Termini) error {
- return b.eth.core.GenerateRecoveryPendingHeader(pendingHeader, checkpointHashes)
+ return b.quai.core.GenerateRecoveryPendingHeader(pendingHeader, checkpointHashes)
}
func (b *QuaiAPIBackend) GetPendingEtxsRollupFromSub(hash common.Hash, location common.Location) (types.PendingEtxsRollup, error) {
- return b.eth.core.GetPendingEtxsRollupFromSub(hash, location)
+ return b.quai.core.GetPendingEtxsRollupFromSub(hash, location)
}
func (b *QuaiAPIBackend) GetPendingEtxsFromSub(hash common.Hash, location common.Location) (types.PendingEtxs, error) {
- return b.eth.core.GetPendingEtxsFromSub(hash, location)
+ return b.quai.core.GetPendingEtxsFromSub(hash, location)
}
func (b *QuaiAPIBackend) SetSyncTarget(header *types.Header) {
- b.eth.core.SetSyncTarget(header)
+ b.quai.core.SetSyncTarget(header)
}
diff --git a/eth/api_test.go b/quai/api_test.go
similarity index 99%
rename from eth/api_test.go
rename to quai/api_test.go
index b14676abd2..d3b0d4027f 100644
--- a/eth/api_test.go
+++ b/quai/api_test.go
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see .
-package eth
+package quai
import (
"bytes"
diff --git a/eth/backend.go b/quai/backend.go
similarity index 94%
rename from eth/backend.go
rename to quai/backend.go
index 1fb6d52589..6bf32c9f0d 100644
--- a/eth/backend.go
+++ b/quai/backend.go
@@ -15,7 +15,7 @@
// along with the go-ethereum library. If not, see .
// Package quai implements the Quai protocol.
-package eth
+package quai
import (
"fmt"
@@ -31,25 +31,25 @@ import (
"github.com/dominant-strategies/go-quai/core/state/pruner"
"github.com/dominant-strategies/go-quai/core/types"
"github.com/dominant-strategies/go-quai/core/vm"
- "github.com/dominant-strategies/go-quai/eth/ethconfig"
- "github.com/dominant-strategies/go-quai/eth/filters"
- "github.com/dominant-strategies/go-quai/eth/gasprice"
"github.com/dominant-strategies/go-quai/ethdb"
"github.com/dominant-strategies/go-quai/event"
"github.com/dominant-strategies/go-quai/internal/quaiapi"
"github.com/dominant-strategies/go-quai/log"
"github.com/dominant-strategies/go-quai/node"
"github.com/dominant-strategies/go-quai/params"
+ "github.com/dominant-strategies/go-quai/quai/filters"
+ "github.com/dominant-strategies/go-quai/quai/gasprice"
+ "github.com/dominant-strategies/go-quai/quai/quaiconfig"
"github.com/dominant-strategies/go-quai/rpc"
)
// Config contains the configuration options of the ETH protocol.
// Deprecated: use ethconfig.Config instead.
-type Config = ethconfig.Config
+type Config = quaiconfig.Config
// Quai implements the Quai full node service.
type Quai struct {
- config *ethconfig.Config
+ config *quaiconfig.Config
// Handlers
core *core.Core
@@ -74,11 +74,11 @@ type Quai struct {
// New creates a new Quai object (including the
// initialisation of the common Quai object)
-func New(stack *node.Node, config *ethconfig.Config, nodeCtx int) (*Quai, error) {
+func New(stack *node.Node, config *quaiconfig.Config, nodeCtx int) (*Quai, error) {
// Ensure configuration values are compatible and sane
if config.Miner.GasPrice == nil || config.Miner.GasPrice.Cmp(common.Big0) <= 0 {
- log.Warn("Sanitizing invalid miner gas price", "provided", config.Miner.GasPrice, "updated", ethconfig.Defaults.Miner.GasPrice)
- config.Miner.GasPrice = new(big.Int).Set(ethconfig.Defaults.Miner.GasPrice)
+ log.Warn("Sanitizing invalid miner gas price", "provided", config.Miner.GasPrice, "updated", quaiconfig.Defaults.Miner.GasPrice)
+ config.Miner.GasPrice = new(big.Int).Set(quaiconfig.Defaults.Miner.GasPrice)
}
if config.NoPruning && config.TrieDirtyCache > 0 {
if config.SnapshotCache > 0 {
@@ -134,13 +134,13 @@ func New(stack *node.Node, config *ethconfig.Config, nodeCtx int) (*Quai, error)
blake3Config := config.Blake3Pow
blake3Config.NotifyFull = config.Miner.NotifyFull
blake3Config.NodeLocation = config.NodeLocation
- quai.engine = ethconfig.CreateBlake3ConsensusEngine(stack, config.NodeLocation, &blake3Config, config.Miner.Notify, config.Miner.Noverify, chainDb)
+ quai.engine = quaiconfig.CreateBlake3ConsensusEngine(stack, config.NodeLocation, &blake3Config, config.Miner.Notify, config.Miner.Noverify, chainDb)
} else {
// Transfer mining-related config to the progpow config.
progpowConfig := config.Progpow
progpowConfig.NodeLocation = config.NodeLocation
progpowConfig.NotifyFull = config.Miner.NotifyFull
- quai.engine = ethconfig.CreateProgpowConsensusEngine(stack, config.NodeLocation, &progpowConfig, config.Miner.Notify, config.Miner.Noverify, chainDb)
+ quai.engine = quaiconfig.CreateProgpowConsensusEngine(stack, config.NodeLocation, &progpowConfig, config.Miner.Notify, config.Miner.Noverify, chainDb)
}
log.Info("Initialised chain configuration", "config", chainConfig)
diff --git a/eth/bloombits.go b/quai/bloombits.go
similarity index 99%
rename from eth/bloombits.go
rename to quai/bloombits.go
index 81f95ba1fa..fadeb80f63 100644
--- a/eth/bloombits.go
+++ b/quai/bloombits.go
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see .
-package eth
+package quai
import (
"time"
diff --git a/eth/filters/api.go b/quai/filters/api.go
similarity index 100%
rename from eth/filters/api.go
rename to quai/filters/api.go
diff --git a/eth/filters/api_test.go b/quai/filters/api_test.go
similarity index 100%
rename from eth/filters/api_test.go
rename to quai/filters/api_test.go
diff --git a/eth/filters/bench_test.go b/quai/filters/bench_test.go
similarity index 100%
rename from eth/filters/bench_test.go
rename to quai/filters/bench_test.go
diff --git a/eth/filters/filter.go b/quai/filters/filter.go
similarity index 100%
rename from eth/filters/filter.go
rename to quai/filters/filter.go
diff --git a/eth/filters/filter_system.go b/quai/filters/filter_system.go
similarity index 100%
rename from eth/filters/filter_system.go
rename to quai/filters/filter_system.go
diff --git a/eth/filters/filter_system_test.go b/quai/filters/filter_system_test.go
similarity index 100%
rename from eth/filters/filter_system_test.go
rename to quai/filters/filter_system_test.go
diff --git a/eth/filters/filter_test.go b/quai/filters/filter_test.go
similarity index 100%
rename from eth/filters/filter_test.go
rename to quai/filters/filter_test.go
diff --git a/eth/gasprice/feehistory.go b/quai/gasprice/feehistory.go
similarity index 100%
rename from eth/gasprice/feehistory.go
rename to quai/gasprice/feehistory.go
diff --git a/eth/gasprice/feehistory_test.go b/quai/gasprice/feehistory_test.go
similarity index 100%
rename from eth/gasprice/feehistory_test.go
rename to quai/gasprice/feehistory_test.go
diff --git a/eth/gasprice/gasprice.go b/quai/gasprice/gasprice.go
similarity index 100%
rename from eth/gasprice/gasprice.go
rename to quai/gasprice/gasprice.go
diff --git a/eth/gasprice/gasprice_test.go b/quai/gasprice/gasprice_test.go
similarity index 100%
rename from eth/gasprice/gasprice_test.go
rename to quai/gasprice/gasprice_test.go
diff --git a/eth/interface.go b/quai/interface.go
similarity index 99%
rename from eth/interface.go
rename to quai/interface.go
index b0d03ea084..a45e9cab4f 100644
--- a/eth/interface.go
+++ b/quai/interface.go
@@ -1,4 +1,4 @@
-package eth
+package quai
import (
"github.com/dominant-strategies/go-quai/common"
diff --git a/eth/p2p_backend.go b/quai/p2p_backend.go
similarity index 99%
rename from eth/p2p_backend.go
rename to quai/p2p_backend.go
index a757ad58fc..8292dec804 100644
--- a/eth/p2p_backend.go
+++ b/quai/p2p_backend.go
@@ -1,4 +1,4 @@
-package eth
+package quai
import (
"github.com/dominant-strategies/go-quai/common"
diff --git a/eth/ethconfig/config.go b/quai/quaiconfig/config.go
similarity index 97%
rename from eth/ethconfig/config.go
rename to quai/quaiconfig/config.go
index eecf34040f..d207d8757d 100644
--- a/eth/ethconfig/config.go
+++ b/quai/quaiconfig/config.go
@@ -14,8 +14,8 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see .
-// Package ethconfig contains the configuration of the ETH and LES protocols.
-package ethconfig
+// Package quaiconfig contains the configuration of the ETH and LES protocols.
+package quaiconfig
import (
"math/big"
@@ -26,11 +26,11 @@ import (
"github.com/dominant-strategies/go-quai/consensus/blake3pow"
"github.com/dominant-strategies/go-quai/consensus/progpow"
"github.com/dominant-strategies/go-quai/core"
- "github.com/dominant-strategies/go-quai/eth/gasprice"
"github.com/dominant-strategies/go-quai/ethdb"
"github.com/dominant-strategies/go-quai/log"
"github.com/dominant-strategies/go-quai/node"
"github.com/dominant-strategies/go-quai/params"
+ "github.com/dominant-strategies/go-quai/quai/gasprice"
)
// FullNodeGPO contains default gasprice oracle settings for full node.
diff --git a/eth/ethconfig/gen_config.go b/quai/quaiconfig/gen_config.go
similarity index 98%
rename from eth/ethconfig/gen_config.go
rename to quai/quaiconfig/gen_config.go
index 0f47affa63..68d7faa726 100644
--- a/eth/ethconfig/gen_config.go
+++ b/quai/quaiconfig/gen_config.go
@@ -1,6 +1,6 @@
// Code generated by github.com/fjl/gencodec. DO NOT EDIT.
-package ethconfig
+package quaiconfig
import (
"time"
@@ -8,7 +8,7 @@ import (
"github.com/dominant-strategies/go-quai/common"
"github.com/dominant-strategies/go-quai/consensus/progpow"
"github.com/dominant-strategies/go-quai/core"
- "github.com/dominant-strategies/go-quai/eth/gasprice"
+ "github.com/dominant-strategies/go-quai/quai/gasprice"
)
// MarshalTOML marshals as TOML.
diff --git a/eth/tracers/api_test.go b/quai/tracers/api_test.go
similarity index 100%
rename from eth/tracers/api_test.go
rename to quai/tracers/api_test.go
diff --git a/eth/tracers/tracers_test.go b/quai/tracers/tracers_test.go
similarity index 100%
rename from eth/tracers/tracers_test.go
rename to quai/tracers/tracers_test.go