cmd/geth, consensus, console, core/vm, eth, les: rename coinbase to etherbase

Renamed Coinbase to Etherbase, fixes #1420

Leaves the values in the json named "coinbase" for backwards compatibility.

Also touches internal/ethapi, internal/jsre, light, miner, mobile
This commit is contained in:
Darrel Herbst 2017-09-26 14:01:57 -04:00
parent 229bf51f0d
commit 8ebcee45a9
48 changed files with 216 additions and 226 deletions

View file

@ -38,12 +38,12 @@ const (
// Tests that a node embedded within a console can be started up properly and // Tests that a node embedded within a console can be started up properly and
// then terminated by closing the input stream. // then terminated by closing the input stream.
func TestConsoleWelcome(t *testing.T) { func TestConsoleWelcome(t *testing.T) {
coinbase := "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182" etherbase := "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182"
// Start a geth console, make sure it's cleaned up and terminate the console // Start a geth console, make sure it's cleaned up and terminate the console
geth := runGeth(t, geth := runGeth(t,
"--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none", "--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none",
"--etherbase", coinbase, "--shh", "--etherbase", etherbase, "--shh",
"console") "console")
// Gather all the infos the welcome message needs to contain // Gather all the infos the welcome message needs to contain
@ -59,7 +59,7 @@ func TestConsoleWelcome(t *testing.T) {
Welcome to the Geth JavaScript console! Welcome to the Geth JavaScript console!
instance: Geth/v{{gethver}}/{{goos}}-{{goarch}}/{{gover}} instance: Geth/v{{gethver}}/{{goos}}-{{goarch}}/{{gover}}
coinbase: {{.Etherbase}} etherbase: {{.Etherbase}}
at block: 0 ({{niltime}}) at block: 0 ({{niltime}})
datadir: {{.Datadir}} datadir: {{.Datadir}}
modules: {{apis}} modules: {{apis}}
@ -72,7 +72,7 @@ at block: 0 ({{niltime}})
// Tests that a console can be attached to a running node via various means. // Tests that a console can be attached to a running node via various means.
func TestIPCAttachWelcome(t *testing.T) { func TestIPCAttachWelcome(t *testing.T) {
// Configure the instance for IPC attachement // Configure the instance for IPC attachement
coinbase := "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182" etherbase := "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182"
var ipc string var ipc string
if runtime.GOOS == "windows" { if runtime.GOOS == "windows" {
ipc = `\\.\pipe\geth` + strconv.Itoa(trulyRandInt(100000, 999999)) ipc = `\\.\pipe\geth` + strconv.Itoa(trulyRandInt(100000, 999999))
@ -85,7 +85,7 @@ func TestIPCAttachWelcome(t *testing.T) {
// list of ipc modules and shh is included there. // list of ipc modules and shh is included there.
geth := runGeth(t, geth := runGeth(t,
"--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none", "--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none",
"--etherbase", coinbase, "--shh", "--ipcpath", ipc) "--etherbase", etherbase, "--shh", "--ipcpath", ipc)
time.Sleep(2 * time.Second) // Simple way to wait for the RPC endpoint to open time.Sleep(2 * time.Second) // Simple way to wait for the RPC endpoint to open
testAttachWelcome(t, geth, "ipc:"+ipc, ipcAPIs) testAttachWelcome(t, geth, "ipc:"+ipc, ipcAPIs)
@ -95,11 +95,11 @@ func TestIPCAttachWelcome(t *testing.T) {
} }
func TestHTTPAttachWelcome(t *testing.T) { func TestHTTPAttachWelcome(t *testing.T) {
coinbase := "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182" etherbase := "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182"
port := strconv.Itoa(trulyRandInt(1024, 65536)) // Yeah, sometimes this will fail, sorry :P port := strconv.Itoa(trulyRandInt(1024, 65536)) // Yeah, sometimes this will fail, sorry :P
geth := runGeth(t, geth := runGeth(t,
"--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none", "--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none",
"--etherbase", coinbase, "--rpc", "--rpcport", port) "--etherbase", etherbase, "--rpc", "--rpcport", port)
time.Sleep(2 * time.Second) // Simple way to wait for the RPC endpoint to open time.Sleep(2 * time.Second) // Simple way to wait for the RPC endpoint to open
testAttachWelcome(t, geth, "http://localhost:"+port, httpAPIs) testAttachWelcome(t, geth, "http://localhost:"+port, httpAPIs)
@ -109,12 +109,12 @@ func TestHTTPAttachWelcome(t *testing.T) {
} }
func TestWSAttachWelcome(t *testing.T) { func TestWSAttachWelcome(t *testing.T) {
coinbase := "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182" etherbase := "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182"
port := strconv.Itoa(trulyRandInt(1024, 65536)) // Yeah, sometimes this will fail, sorry :P port := strconv.Itoa(trulyRandInt(1024, 65536)) // Yeah, sometimes this will fail, sorry :P
geth := runGeth(t, geth := runGeth(t,
"--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none", "--port", "0", "--maxpeers", "0", "--nodiscover", "--nat", "none",
"--etherbase", coinbase, "--ws", "--wsport", port) "--etherbase", etherbase, "--ws", "--wsport", port)
time.Sleep(2 * time.Second) // Simple way to wait for the RPC endpoint to open time.Sleep(2 * time.Second) // Simple way to wait for the RPC endpoint to open
testAttachWelcome(t, geth, "ws://localhost:"+port, httpAPIs) testAttachWelcome(t, geth, "ws://localhost:"+port, httpAPIs)
@ -145,7 +145,7 @@ func testAttachWelcome(t *testing.T, geth *testgeth, endpoint, apis string) {
Welcome to the Geth JavaScript console! Welcome to the Geth JavaScript console!
instance: Geth/v{{gethver}}/{{goos}}-{{goarch}}/{{gover}} instance: Geth/v{{gethver}}/{{goos}}-{{goarch}}/{{gover}}
coinbase: {{etherbase}} etherbase: {{etherbase}}
at block: 0 ({{niltime}}){{if ipc}} at block: 0 ({{niltime}}){{if ipc}}
datadir: {{datadir}}{{end}} datadir: {{datadir}}{{end}}
modules: {{apis}} modules: {{apis}}

View file

@ -143,7 +143,7 @@ func sigHash(header *types.Header) (hash common.Hash) {
rlp.Encode(hasher, []interface{}{ rlp.Encode(hasher, []interface{}{
header.ParentHash, header.ParentHash,
header.UncleHash, header.UncleHash,
header.Coinbase, header.Etherbase,
header.Root, header.Root,
header.TxHash, header.TxHash,
header.ReceiptHash, header.ReceiptHash,
@ -274,7 +274,7 @@ func (c *Clique) verifyHeader(chain consensus.ChainReader, header *types.Header,
} }
// Checkpoint blocks need to enforce zero beneficiary // Checkpoint blocks need to enforce zero beneficiary
checkpoint := (number % c.config.Epoch) == 0 checkpoint := (number % c.config.Epoch) == 0
if checkpoint && header.Coinbase != (common.Address{}) { if checkpoint && header.Etherbase != (common.Address{}) {
return errInvalidCheckpointBeneficiary return errInvalidCheckpointBeneficiary
} }
// Nonces must be 0x00..0 or 0xff..f, zeroes enforced on checkpoints // Nonces must be 0x00..0 or 0xff..f, zeroes enforced on checkpoints
@ -499,7 +499,7 @@ func (c *Clique) verifySeal(chain consensus.ChainReader, header *types.Header, p
// header for running the transactions on top. // header for running the transactions on top.
func (c *Clique) Prepare(chain consensus.ChainReader, header *types.Header) error { func (c *Clique) Prepare(chain consensus.ChainReader, header *types.Header) error {
// If the block isn't a checkpoint, cast a random vote (good enough for now) // If the block isn't a checkpoint, cast a random vote (good enough for now)
header.Coinbase = common.Address{} header.Etherbase = common.Address{}
header.Nonce = types.BlockNonce{} header.Nonce = types.BlockNonce{}
number := header.Number.Uint64() number := header.Number.Uint64()
@ -521,8 +521,8 @@ func (c *Clique) Prepare(chain consensus.ChainReader, header *types.Header) erro
} }
// If there's pending proposals, cast a vote on them // If there's pending proposals, cast a vote on them
if len(addresses) > 0 { if len(addresses) > 0 {
header.Coinbase = addresses[rand.Intn(len(addresses))] header.Etherbase = addresses[rand.Intn(len(addresses))]
if c.proposals[header.Coinbase] { if c.proposals[header.Etherbase] {
copy(header.Nonce[:], nonceAuthVote) copy(header.Nonce[:], nonceAuthVote)
} else { } else {
copy(header.Nonce[:], nonceDropVote) copy(header.Nonce[:], nonceDropVote)

View file

@ -217,7 +217,7 @@ func (s *Snapshot) apply(headers []*types.Header) (*Snapshot, error) {
// Header authorized, discard any previous votes from the signer // Header authorized, discard any previous votes from the signer
for i, vote := range snap.Votes { for i, vote := range snap.Votes {
if vote.Signer == signer && vote.Address == header.Coinbase { if vote.Signer == signer && vote.Address == header.Etherbase {
// Uncast the vote from the cached tally // Uncast the vote from the cached tally
snap.uncast(vote.Address, vote.Authorize) snap.uncast(vote.Address, vote.Authorize)
@ -236,20 +236,20 @@ func (s *Snapshot) apply(headers []*types.Header) (*Snapshot, error) {
default: default:
return nil, errInvalidVote return nil, errInvalidVote
} }
if snap.cast(header.Coinbase, authorize) { if snap.cast(header.Etherbase, authorize) {
snap.Votes = append(snap.Votes, &Vote{ snap.Votes = append(snap.Votes, &Vote{
Signer: signer, Signer: signer,
Block: number, Block: number,
Address: header.Coinbase, Address: header.Etherbase,
Authorize: authorize, Authorize: authorize,
}) })
} }
// If the vote passed, update the list of signers // If the vote passed, update the list of signers
if tally := snap.Tally[header.Coinbase]; tally.Votes > len(snap.Signers)/2 { if tally := snap.Tally[header.Etherbase]; tally.Votes > len(snap.Signers)/2 {
if tally.Authorize { if tally.Authorize {
snap.Signers[header.Coinbase] = struct{}{} snap.Signers[header.Etherbase] = struct{}{}
} else { } else {
delete(snap.Signers, header.Coinbase) delete(snap.Signers, header.Etherbase)
// Signer list shrunk, delete any leftover recent caches // Signer list shrunk, delete any leftover recent caches
if limit := uint64(len(snap.Signers)/2 + 1); number >= limit { if limit := uint64(len(snap.Signers)/2 + 1); number >= limit {
@ -257,7 +257,7 @@ func (s *Snapshot) apply(headers []*types.Header) (*Snapshot, error) {
} }
// Discard any previous votes the deauthorized signer cast // Discard any previous votes the deauthorized signer cast
for i := 0; i < len(snap.Votes); i++ { for i := 0; i < len(snap.Votes); i++ {
if snap.Votes[i].Signer == header.Coinbase { if snap.Votes[i].Signer == header.Etherbase {
// Uncast the vote from the cached tally // Uncast the vote from the cached tally
snap.uncast(snap.Votes[i].Address, snap.Votes[i].Authorize) snap.uncast(snap.Votes[i].Address, snap.Votes[i].Authorize)
@ -270,12 +270,12 @@ func (s *Snapshot) apply(headers []*types.Header) (*Snapshot, error) {
} }
// Discard any previous votes around the just changed account // Discard any previous votes around the just changed account
for i := 0; i < len(snap.Votes); i++ { for i := 0; i < len(snap.Votes); i++ {
if snap.Votes[i].Address == header.Coinbase { if snap.Votes[i].Address == header.Etherbase {
snap.Votes = append(snap.Votes[:i], snap.Votes[i+1:]...) snap.Votes = append(snap.Votes[:i], snap.Votes[i+1:]...)
i-- i--
} }
} }
delete(snap.Tally, header.Coinbase) delete(snap.Tally, header.Etherbase)
} }
} }
snap.Number += uint64(len(headers)) snap.Number += uint64(len(headers))

View file

@ -360,7 +360,7 @@ func TestVoting(t *testing.T) {
headers[j] = &types.Header{ headers[j] = &types.Header{
Number: big.NewInt(int64(j) + 1), Number: big.NewInt(int64(j) + 1),
Time: big.NewInt(int64(j) * int64(blockPeriod)), Time: big.NewInt(int64(j) * int64(blockPeriod)),
Coinbase: accounts.address(vote.voted), Etherbase: accounts.address(vote.voted),
Extra: make([]byte, extraVanity+extraSeal), Extra: make([]byte, extraVanity+extraSeal),
} }
if j > 0 { if j > 0 {

View file

@ -50,7 +50,7 @@ type ChainReader interface {
// Engine is an algorithm agnostic consensus engine. // Engine is an algorithm agnostic consensus engine.
type Engine interface { type Engine interface {
// Author retrieves the Ethereum address of the account that minted the given // Author retrieves the Ethereum address of the account that minted the given
// block, which may be different from the header's coinbase if a consensus // block, which may be different from the header's etherbase if a consensus
// engine is based on signatures. // engine is based on signatures.
Author(header *types.Header) (common.Address, error) Author(header *types.Header) (common.Address, error)

View file

@ -683,7 +683,7 @@ func TestConcurrentDiskCacheGeneration(t *testing.T) {
Number: big.NewInt(3311058), Number: big.NewInt(3311058),
ParentHash: common.HexToHash("0xd783efa4d392943503f28438ad5830b2d5964696ffc285f338585e9fe0a37a05"), ParentHash: common.HexToHash("0xd783efa4d392943503f28438ad5830b2d5964696ffc285f338585e9fe0a37a05"),
UncleHash: common.HexToHash("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"), UncleHash: common.HexToHash("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"),
Coinbase: common.HexToAddress("0xc0ea08a2d404d3172d2add29a45be56da40e2949"), Etherbase: common.HexToAddress("0xc0ea08a2d404d3172d2add29a45be56da40e2949"),
Root: common.HexToHash("0x77d14e10470b5850332524f8cd6f69ad21f070ce92dca33ab2858300242ef2f1"), Root: common.HexToHash("0x77d14e10470b5850332524f8cd6f69ad21f070ce92dca33ab2858300242ef2f1"),
TxHash: common.HexToHash("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"), TxHash: common.HexToHash("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"),
ReceiptHash: common.HexToHash("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"), ReceiptHash: common.HexToHash("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"),

View file

@ -58,10 +58,10 @@ var (
errInvalidPoW = errors.New("invalid proof-of-work") errInvalidPoW = errors.New("invalid proof-of-work")
) )
// Author implements consensus.Engine, returning the header's coinbase as the // Author implements consensus.Engine, returning the header's etherbase as the
// proof-of-work verified author of the block. // proof-of-work verified author of the block.
func (ethash *Ethash) Author(header *types.Header) (common.Address, error) { func (ethash *Ethash) Author(header *types.Header) (common.Address, error) {
return header.Coinbase, nil return header.Etherbase, nil
} }
// VerifyHeader checks whether a header conforms to the consensus rules of the // VerifyHeader checks whether a header conforms to the consensus rules of the
@ -523,9 +523,9 @@ var (
big32 = big.NewInt(32) big32 = big.NewInt(32)
) )
// AccumulateRewards credits the coinbase of the given block with the mining // AccumulateRewards credits the etherbase of the given block with the mining
// reward. The total reward consists of the static block reward and rewards for // reward. The total reward consists of the static block reward and rewards for
// included uncles. The coinbase of each uncle block is also rewarded. // included uncles. The etherbase of each uncle block is also rewarded.
// TODO (karalabe): Move the chain maker into this package and make this private! // TODO (karalabe): Move the chain maker into this package and make this private!
func AccumulateRewards(config *params.ChainConfig, state *state.StateDB, header *types.Header, uncles []*types.Header) { func AccumulateRewards(config *params.ChainConfig, state *state.StateDB, header *types.Header, uncles []*types.Header) {
// Select the correct block reward based on chain progression // Select the correct block reward based on chain progression
@ -541,10 +541,10 @@ func AccumulateRewards(config *params.ChainConfig, state *state.StateDB, header
r.Sub(r, header.Number) r.Sub(r, header.Number)
r.Mul(r, blockReward) r.Mul(r, blockReward)
r.Div(r, big8) r.Div(r, big8)
state.AddBalance(uncle.Coinbase, r) state.AddBalance(uncle.Etherbase, r)
r.Div(blockReward, big32) r.Div(blockReward, big32)
reward.Add(reward, r) reward.Add(reward, r)
} }
state.AddBalance(header.Coinbase, reward) state.AddBalance(header.Etherbase, reward)
} }

View file

@ -261,7 +261,7 @@ func (c *Console) Welcome() {
fmt.Fprintf(c.printer, "Welcome to the Geth JavaScript console!\n\n") fmt.Fprintf(c.printer, "Welcome to the Geth JavaScript console!\n\n")
c.jsre.Run(` c.jsre.Run(`
console.log("instance: " + web3.version.node); console.log("instance: " + web3.version.node);
console.log("coinbase: " + eth.coinbase); console.log("etherbase: " + eth.etherbase);
console.log("at block: " + eth.blockNumber + " (" + new Date(1000 * eth.getBlock(eth.blockNumber).timestamp) + ")"); console.log("at block: " + eth.blockNumber + " (" + new Date(1000 * eth.getBlock(eth.blockNumber).timestamp) + ")");
console.log(" datadir: " + admin.datadir); console.log(" datadir: " + admin.datadir);
`) `)

View file

@ -152,7 +152,7 @@ func (env *tester) Close(t *testing.T) {
} }
// Tests that the node lists the correct welcome message, notably that it contains // Tests that the node lists the correct welcome message, notably that it contains
// the instance name, coinbase account, block number, data directory and supported // the instance name, etherbase account, block number, data directory and supported
// console modules. // console modules.
func TestWelcome(t *testing.T) { func TestWelcome(t *testing.T) {
tester := newTester(t, nil) tester := newTester(t, nil)
@ -167,14 +167,14 @@ func TestWelcome(t *testing.T) {
if want := fmt.Sprintf("instance: %s", testInstance); !strings.Contains(output, want) { if want := fmt.Sprintf("instance: %s", testInstance); !strings.Contains(output, want) {
t.Fatalf("console output missing instance: have\n%s\nwant also %s", output, want) t.Fatalf("console output missing instance: have\n%s\nwant also %s", output, want)
} }
if want := fmt.Sprintf("coinbase: %s", testAddress); !strings.Contains(output, want) { if want := fmt.Sprintf("etherbase: %s", testAddress); !strings.Contains(output, want) {
t.Fatalf("console output missing coinbase: have\n%s\nwant also %s", output, want) t.Fatalf("console output missing etherbase: have\n%s\nwant also %s", output, want)
} }
if want := "at block: 0"; !strings.Contains(output, want) { if want := "at block: 0"; !strings.Contains(output, want) {
t.Fatalf("console output missing sync status: have\n%s\nwant also %s", output, want) t.Fatalf("console output missing sync status: have\n%s\nwant also %s", output, want)
} }
if want := fmt.Sprintf("datadir: %s", tester.workspace); !strings.Contains(output, want) { if want := fmt.Sprintf("datadir: %s", tester.workspace); !strings.Contains(output, want) {
t.Fatalf("console output missing coinbase: have\n%s\nwant also %s", output, want) t.Fatalf("console output missing etherbase: have\n%s\nwant also %s", output, want)
} }
} }

View file

@ -226,7 +226,7 @@ func makeChainForBench(db ethdb.Database, full bool, count uint64) {
var hash common.Hash var hash common.Hash
for n := uint64(0); n < count; n++ { for n := uint64(0); n < count; n++ {
header := &types.Header{ header := &types.Header{
Coinbase: common.Address{}, Etherbase: common.Address{},
Number: big.NewInt(int64(n)), Number: big.NewInt(int64(n)),
ParentHash: hash, ParentHash: hash,
Difficulty: big.NewInt(1), Difficulty: big.NewInt(1),

View file

@ -360,7 +360,7 @@ func makeBlockChainWithDiff(genesis *types.Block, d []int, seed byte) []*types.B
var chain []*types.Block var chain []*types.Block
for i, difficulty := range d { for i, difficulty := range d {
header := &types.Header{ header := &types.Header{
Coinbase: common.Address{seed}, Etherbase: common.Address{seed},
Number: big.NewInt(int64(i + 1)), Number: big.NewInt(int64(i + 1)),
Difficulty: big.NewInt(int64(difficulty)), Difficulty: big.NewInt(int64(difficulty)),
UncleHash: types.EmptyUncleHash, UncleHash: types.EmptyUncleHash,
@ -589,7 +589,7 @@ func TestFastVsFullChains(t *testing.T) {
signer = types.NewEIP155Signer(gspec.Config.ChainId) signer = types.NewEIP155Signer(gspec.Config.ChainId)
) )
blocks, receipts := GenerateChain(gspec.Config, genesis, gendb, 1024, func(i int, block *BlockGen) { blocks, receipts := GenerateChain(gspec.Config, genesis, gendb, 1024, func(i int, block *BlockGen) {
block.SetCoinbase(common.Address{0x00}) block.SetEtherbase(common.Address{0x00})
// If the block number is multiple of 3, send a few bonus transactions to the miner // If the block number is multiple of 3, send a few bonus transactions to the miner
if i%3 == 2 { if i%3 == 2 {

View file

@ -53,16 +53,16 @@ type BlockGen struct {
config *params.ChainConfig config *params.ChainConfig
} }
// SetCoinbase sets the coinbase of the generated block. // SetEtherbase sets the etherbase of the generated block.
// It can be called at most once. // It can be called at most once.
func (b *BlockGen) SetCoinbase(addr common.Address) { func (b *BlockGen) SetEtherbase(addr common.Address) {
if b.gasPool != nil { if b.gasPool != nil {
if len(b.txs) > 0 { if len(b.txs) > 0 {
panic("coinbase must be set before adding transactions") panic("etherbase must be set before adding transactions")
} }
panic("coinbase can only be set once") panic("etherbase can only be set once")
} }
b.header.Coinbase = addr b.header.Etherbase = addr
b.gasPool = new(GasPool).AddGas(b.header.GasLimit) b.gasPool = new(GasPool).AddGas(b.header.GasLimit)
} }
@ -71,8 +71,8 @@ func (b *BlockGen) SetExtra(data []byte) {
b.header.Extra = data b.header.Extra = data
} }
// AddTx adds a transaction to the generated block. If no coinbase has // AddTx adds a transaction to the generated block. If no etherbase has
// been set, the block's coinbase is set to the zero address. // been set, the block's etherbase is set to the zero address.
// //
// AddTx panics if the transaction cannot be executed. In addition to // AddTx panics if the transaction cannot be executed. In addition to
// the protocol-imposed limitations (gas limit, etc.), there are some // the protocol-imposed limitations (gas limit, etc.), there are some
@ -81,10 +81,10 @@ func (b *BlockGen) SetExtra(data []byte) {
// will panic during execution. // will panic during execution.
func (b *BlockGen) AddTx(tx *types.Transaction) { func (b *BlockGen) AddTx(tx *types.Transaction) {
if b.gasPool == nil { if b.gasPool == nil {
b.SetCoinbase(common.Address{}) b.SetEtherbase(common.Address{})
} }
b.statedb.Prepare(tx.Hash(), common.Hash{}, len(b.txs)) b.statedb.Prepare(tx.Hash(), common.Hash{}, len(b.txs))
receipt, _, err := ApplyTransaction(b.config, nil, &b.header.Coinbase, b.gasPool, b.statedb, b.header, tx, b.header.GasUsed, vm.Config{}) receipt, _, err := ApplyTransaction(b.config, nil, &b.header.Etherbase, b.gasPool, b.statedb, b.header, tx, b.header.GasUsed, vm.Config{})
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -151,7 +151,7 @@ func (b *BlockGen) OffsetTime(seconds int64) {
// The generator function is called with a new block generator for // The generator function is called with a new block generator for
// every block. Any transactions and uncles added to the generator // every block. Any transactions and uncles added to the generator
// become part of the block. If gen is nil, the blocks will be empty // become part of the block. If gen is nil, the blocks will be empty
// and their coinbase will be the zero address. // and their etherbase will be the zero address.
// //
// Blocks created by GenerateChain do not contain valid proof of work // Blocks created by GenerateChain do not contain valid proof of work
// values. Inserting them into BlockChain requires use of FakePow or // values. Inserting them into BlockChain requires use of FakePow or
@ -212,7 +212,7 @@ func makeHeader(config *params.ChainConfig, parent *types.Block, state *state.St
return &types.Header{ return &types.Header{
Root: state.IntermediateRoot(config.IsEIP158(parent.Number())), Root: state.IntermediateRoot(config.IsEIP158(parent.Number())),
ParentHash: parent.Hash(), ParentHash: parent.Hash(),
Coinbase: parent.Coinbase(), Etherbase: parent.Etherbase(),
Difficulty: ethash.CalcDifficulty(config, time.Uint64(), &types.Header{ Difficulty: ethash.CalcDifficulty(config, time.Uint64(), &types.Header{
Number: parent.Number(), Number: parent.Number(),
Time: new(big.Int).Sub(time, big.NewInt(10)), Time: new(big.Int).Sub(time, big.NewInt(10)),
@ -265,7 +265,7 @@ func makeHeaderChain(parent *types.Header, n int, db ethdb.Database, seed int) [
// makeBlockChain creates a deterministic chain of blocks rooted at parent. // makeBlockChain creates a deterministic chain of blocks rooted at parent.
func makeBlockChain(parent *types.Block, n int, db ethdb.Database, seed int) []*types.Block { func makeBlockChain(parent *types.Block, n int, db ethdb.Database, seed int) []*types.Block {
blocks, _ := GenerateChain(params.TestChainConfig, parent, db, n, func(i int, b *BlockGen) { blocks, _ := GenerateChain(params.TestChainConfig, parent, db, n, func(i int, b *BlockGen) {
b.SetCoinbase(common.Address{0: byte(seed), 19: byte(i)}) b.SetEtherbase(common.Address{0: byte(seed), 19: byte(i)})
}) })
return blocks return blocks
} }

View file

@ -65,7 +65,7 @@ func ExampleGenerateChain() {
gen.AddTx(tx2) gen.AddTx(tx2)
case 2: case 2:
// Block 3 is empty but was mined by addr3. // Block 3 is empty but was mined by addr3.
gen.SetCoinbase(addr3) gen.SetEtherbase(addr3)
gen.SetExtra([]byte("yeehaw")) gen.SetExtra([]byte("yeehaw"))
case 3: case 3:
// Block 4 includes blocks 2 and 3 as uncle headers (with modified extra data). // Block 4 includes blocks 2 and 3 as uncle headers (with modified extra data).

View file

@ -49,7 +49,7 @@ func NewEVMContext(msg Message, header *types.Header, chain ChainContext, author
Transfer: Transfer, Transfer: Transfer,
GetHash: GetHashFn(header, chain), GetHash: GetHashFn(header, chain),
Origin: msg.From(), Origin: msg.From(),
Coinbase: beneficiary, Etherbase: beneficiary,
BlockNumber: new(big.Int).Set(header.Number), BlockNumber: new(big.Int).Set(header.Number),
Time: new(big.Int).Set(header.Time), Time: new(big.Int).Set(header.Time),
Difficulty: new(big.Int).Set(header.Difficulty), Difficulty: new(big.Int).Set(header.Difficulty),

View file

@ -22,7 +22,7 @@ func (g Genesis) MarshalJSON() ([]byte, error) {
GasLimit math.HexOrDecimal64 `json:"gasLimit" gencodec:"required"` GasLimit math.HexOrDecimal64 `json:"gasLimit" gencodec:"required"`
Difficulty *math.HexOrDecimal256 `json:"difficulty" gencodec:"required"` Difficulty *math.HexOrDecimal256 `json:"difficulty" gencodec:"required"`
Mixhash common.Hash `json:"mixHash"` Mixhash common.Hash `json:"mixHash"`
Coinbase common.Address `json:"coinbase"` Etherbase common.Address `json:"coinbase"`
Alloc map[common.UnprefixedAddress]GenesisAccount `json:"alloc" gencodec:"required"` Alloc map[common.UnprefixedAddress]GenesisAccount `json:"alloc" gencodec:"required"`
Number math.HexOrDecimal64 `json:"number"` Number math.HexOrDecimal64 `json:"number"`
GasUsed math.HexOrDecimal64 `json:"gasUsed"` GasUsed math.HexOrDecimal64 `json:"gasUsed"`
@ -36,7 +36,7 @@ func (g Genesis) MarshalJSON() ([]byte, error) {
enc.GasLimit = math.HexOrDecimal64(g.GasLimit) enc.GasLimit = math.HexOrDecimal64(g.GasLimit)
enc.Difficulty = (*math.HexOrDecimal256)(g.Difficulty) enc.Difficulty = (*math.HexOrDecimal256)(g.Difficulty)
enc.Mixhash = g.Mixhash enc.Mixhash = g.Mixhash
enc.Coinbase = g.Coinbase enc.Etherbase = g.Etherbase
if g.Alloc != nil { if g.Alloc != nil {
enc.Alloc = make(map[common.UnprefixedAddress]GenesisAccount, len(g.Alloc)) enc.Alloc = make(map[common.UnprefixedAddress]GenesisAccount, len(g.Alloc))
for k, v := range g.Alloc { for k, v := range g.Alloc {
@ -58,7 +58,7 @@ func (g *Genesis) UnmarshalJSON(input []byte) error {
GasLimit *math.HexOrDecimal64 `json:"gasLimit" gencodec:"required"` GasLimit *math.HexOrDecimal64 `json:"gasLimit" gencodec:"required"`
Difficulty *math.HexOrDecimal256 `json:"difficulty" gencodec:"required"` Difficulty *math.HexOrDecimal256 `json:"difficulty" gencodec:"required"`
Mixhash *common.Hash `json:"mixHash"` Mixhash *common.Hash `json:"mixHash"`
Coinbase *common.Address `json:"coinbase"` Etherbase *common.Address `json:"coinbase"`
Alloc map[common.UnprefixedAddress]GenesisAccount `json:"alloc" gencodec:"required"` Alloc map[common.UnprefixedAddress]GenesisAccount `json:"alloc" gencodec:"required"`
Number *math.HexOrDecimal64 `json:"number"` Number *math.HexOrDecimal64 `json:"number"`
GasUsed *math.HexOrDecimal64 `json:"gasUsed"` GasUsed *math.HexOrDecimal64 `json:"gasUsed"`
@ -91,8 +91,8 @@ func (g *Genesis) UnmarshalJSON(input []byte) error {
if dec.Mixhash != nil { if dec.Mixhash != nil {
g.Mixhash = *dec.Mixhash g.Mixhash = *dec.Mixhash
} }
if dec.Coinbase != nil { if dec.Etherbase != nil {
g.Coinbase = *dec.Coinbase g.Etherbase = *dec.Etherbase
} }
if dec.Alloc == nil { if dec.Alloc == nil {
return errors.New("missing required field 'alloc' for Genesis") return errors.New("missing required field 'alloc' for Genesis")

View file

@ -51,7 +51,7 @@ type Genesis struct {
GasLimit uint64 `json:"gasLimit" gencodec:"required"` GasLimit uint64 `json:"gasLimit" gencodec:"required"`
Difficulty *big.Int `json:"difficulty" gencodec:"required"` Difficulty *big.Int `json:"difficulty" gencodec:"required"`
Mixhash common.Hash `json:"mixHash"` Mixhash common.Hash `json:"mixHash"`
Coinbase common.Address `json:"coinbase"` Etherbase common.Address `json:"coinbase"`
Alloc GenesisAlloc `json:"alloc" gencodec:"required"` Alloc GenesisAlloc `json:"alloc" gencodec:"required"`
// These fields are used for consensus tests. Please don't use them // These fields are used for consensus tests. Please don't use them
@ -243,7 +243,7 @@ func (g *Genesis) ToBlock() (*types.Block, *state.StateDB) {
GasUsed: new(big.Int).SetUint64(g.GasUsed), GasUsed: new(big.Int).SetUint64(g.GasUsed),
Difficulty: g.Difficulty, Difficulty: g.Difficulty,
MixDigest: g.Mixhash, MixDigest: g.Mixhash,
Coinbase: g.Coinbase, Etherbase: g.Etherbase,
Root: root, Root: root,
} }
if g.GasLimit == 0 { if g.GasLimit == 0 {

View file

@ -50,7 +50,7 @@ func NewStateProcessor(config *params.ChainConfig, bc *BlockChain, engine consen
// Process processes the state changes according to the Ethereum rules by running // Process processes the state changes according to the Ethereum rules by running
// the transaction messages using the statedb and applying any rewards to both // the transaction messages using the statedb and applying any rewards to both
// the processor (coinbase) and any included uncles. // the processor (etherbase) and any included uncles.
// //
// Process returns the receipts and logs accumulated during the process and // Process returns the receipts and logs accumulated during the process and
// returns the amount of gas that was used in the process. If any of the // returns the amount of gas that was used in the process. If any of the

View file

@ -255,7 +255,7 @@ func (st *StateTransition) TransitionDb() (ret []byte, requiredGas, usedGas *big
requiredGas = new(big.Int).Set(st.gasUsed()) requiredGas = new(big.Int).Set(st.gasUsed())
st.refundGas() st.refundGas()
st.state.AddBalance(st.evm.Coinbase, new(big.Int).Mul(st.gasUsed(), st.gasPrice)) st.state.AddBalance(st.evm.Etherbase, new(big.Int).Mul(st.gasUsed(), st.gasPrice))
return ret, requiredGas, st.gasUsed(), vmerr != nil, err return ret, requiredGas, st.gasUsed(), vmerr != nil, err
} }

View file

@ -70,7 +70,7 @@ func (n *BlockNonce) UnmarshalText(input []byte) error {
type Header struct { type Header struct {
ParentHash common.Hash `json:"parentHash" gencodec:"required"` ParentHash common.Hash `json:"parentHash" gencodec:"required"`
UncleHash common.Hash `json:"sha3Uncles" gencodec:"required"` UncleHash common.Hash `json:"sha3Uncles" gencodec:"required"`
Coinbase common.Address `json:"miner" gencodec:"required"` Etherbase common.Address `json:"miner" gencodec:"required"`
Root common.Hash `json:"stateRoot" gencodec:"required"` Root common.Hash `json:"stateRoot" gencodec:"required"`
TxHash common.Hash `json:"transactionsRoot" gencodec:"required"` TxHash common.Hash `json:"transactionsRoot" gencodec:"required"`
ReceiptHash common.Hash `json:"receiptsRoot" gencodec:"required"` ReceiptHash common.Hash `json:"receiptsRoot" gencodec:"required"`
@ -107,7 +107,7 @@ func (h *Header) HashNoNonce() common.Hash {
return rlpHash([]interface{}{ return rlpHash([]interface{}{
h.ParentHash, h.ParentHash,
h.UncleHash, h.UncleHash,
h.Coinbase, h.Etherbase,
h.Root, h.Root,
h.TxHash, h.TxHash,
h.ReceiptHash, h.ReceiptHash,
@ -311,7 +311,7 @@ func (b *Block) NumberU64() uint64 { return b.header.Number.Uint64() }
func (b *Block) MixDigest() common.Hash { return b.header.MixDigest } func (b *Block) MixDigest() common.Hash { return b.header.MixDigest }
func (b *Block) Nonce() uint64 { return binary.BigEndian.Uint64(b.header.Nonce[:]) } func (b *Block) Nonce() uint64 { return binary.BigEndian.Uint64(b.header.Nonce[:]) }
func (b *Block) Bloom() Bloom { return b.header.Bloom } func (b *Block) Bloom() Bloom { return b.header.Bloom }
func (b *Block) Coinbase() common.Address { return b.header.Coinbase } func (b *Block) Etherbase() common.Address { return b.header.Etherbase }
func (b *Block) Root() common.Hash { return b.header.Root } func (b *Block) Root() common.Hash { return b.header.Root }
func (b *Block) ParentHash() common.Hash { return b.header.ParentHash } func (b *Block) ParentHash() common.Hash { return b.header.ParentHash }
func (b *Block) TxHash() common.Hash { return b.header.TxHash } func (b *Block) TxHash() common.Hash { return b.header.TxHash }
@ -404,7 +404,7 @@ func (h *Header) String() string {
[ [
ParentHash: %x ParentHash: %x
UncleHash: %x UncleHash: %x
Coinbase: %x Etherbase: %x
Root: %x Root: %x
TxSha %x TxSha %x
ReceiptSha: %x ReceiptSha: %x
@ -417,7 +417,7 @@ func (h *Header) String() string {
Extra: %s Extra: %s
MixDigest: %x MixDigest: %x
Nonce: %x Nonce: %x
]`, h.Hash(), h.ParentHash, h.UncleHash, h.Coinbase, h.Root, h.TxHash, h.ReceiptHash, h.Bloom, h.Difficulty, h.Number, h.GasLimit, h.GasUsed, h.Time, h.Extra, h.MixDigest, h.Nonce) ]`, h.Hash(), h.ParentHash, h.UncleHash, h.Etherbase, h.Root, h.TxHash, h.ReceiptHash, h.Bloom, h.Difficulty, h.Number, h.GasLimit, h.GasUsed, h.Time, h.Extra, h.MixDigest, h.Nonce)
} }
type Blocks []*Block type Blocks []*Block

View file

@ -43,7 +43,7 @@ func TestBlockEncoding(t *testing.T) {
check("Difficulty", block.Difficulty(), big.NewInt(131072)) check("Difficulty", block.Difficulty(), big.NewInt(131072))
check("GasLimit", block.GasLimit(), big.NewInt(3141592)) check("GasLimit", block.GasLimit(), big.NewInt(3141592))
check("GasUsed", block.GasUsed(), big.NewInt(21000)) check("GasUsed", block.GasUsed(), big.NewInt(21000))
check("Coinbase", block.Coinbase(), common.HexToAddress("8888f1f195afa192cfee860698584c030f4c9db1")) check("Etherbase", block.Etherbase(), common.HexToAddress("8888f1f195afa192cfee860698584c030f4c9db1"))
check("MixDigest", block.MixDigest(), common.HexToHash("bd4472abb6659ebe3ee06ee4d7b72a00a9f4d001caca51342001075469aff498")) check("MixDigest", block.MixDigest(), common.HexToHash("bd4472abb6659ebe3ee06ee4d7b72a00a9f4d001caca51342001075469aff498"))
check("Root", block.Root(), common.HexToHash("ef1552a40b7165c3cd773806b9e0c165b75356e0314bf0706f279c729f51e017")) check("Root", block.Root(), common.HexToHash("ef1552a40b7165c3cd773806b9e0c165b75356e0314bf0706f279c729f51e017"))
check("Hash", block.Hash(), common.HexToHash("0a5843ac1cb04865017cb35a57b50b07084e5fcee39b5acadade33149f4fff9e")) check("Hash", block.Hash(), common.HexToHash("0a5843ac1cb04865017cb35a57b50b07084e5fcee39b5acadade33149f4fff9e"))

View file

@ -72,8 +72,8 @@ func TestBloom9(t *testing.T) {
func TestAddress(t *testing.T) { func TestAddress(t *testing.T) {
block := &Block{} block := &Block{}
block.Coinbase = common.Hex2Bytes("22341ae42d6dd7384bc8584e50419ea3ac75b83f") block.Etherbase = common.Hex2Bytes("22341ae42d6dd7384bc8584e50419ea3ac75b83f")
fmt.Printf("%x\n", crypto.Keccak256(block.Coinbase)) fmt.Printf("%x\n", crypto.Keccak256(block.Etherbase))
bin := CreateBloom(block) bin := CreateBloom(block)
fmt.Printf("bin = %x\n", common.LeftPadBytes(bin, 64)) fmt.Printf("bin = %x\n", common.LeftPadBytes(bin, 64))

View file

@ -15,7 +15,7 @@ func (h Header) MarshalJSON() ([]byte, error) {
type Header struct { type Header struct {
ParentHash common.Hash `json:"parentHash" gencodec:"required"` ParentHash common.Hash `json:"parentHash" gencodec:"required"`
UncleHash common.Hash `json:"sha3Uncles" gencodec:"required"` UncleHash common.Hash `json:"sha3Uncles" gencodec:"required"`
Coinbase common.Address `json:"miner" gencodec:"required"` Etherbase common.Address `json:"miner" gencodec:"required"`
Root common.Hash `json:"stateRoot" gencodec:"required"` Root common.Hash `json:"stateRoot" gencodec:"required"`
TxHash common.Hash `json:"transactionsRoot" gencodec:"required"` TxHash common.Hash `json:"transactionsRoot" gencodec:"required"`
ReceiptHash common.Hash `json:"receiptsRoot" gencodec:"required"` ReceiptHash common.Hash `json:"receiptsRoot" gencodec:"required"`
@ -33,7 +33,7 @@ func (h Header) MarshalJSON() ([]byte, error) {
var enc Header var enc Header
enc.ParentHash = h.ParentHash enc.ParentHash = h.ParentHash
enc.UncleHash = h.UncleHash enc.UncleHash = h.UncleHash
enc.Coinbase = h.Coinbase enc.Etherbase = h.Etherbase
enc.Root = h.Root enc.Root = h.Root
enc.TxHash = h.TxHash enc.TxHash = h.TxHash
enc.ReceiptHash = h.ReceiptHash enc.ReceiptHash = h.ReceiptHash
@ -54,7 +54,7 @@ func (h *Header) UnmarshalJSON(input []byte) error {
type Header struct { type Header struct {
ParentHash *common.Hash `json:"parentHash" gencodec:"required"` ParentHash *common.Hash `json:"parentHash" gencodec:"required"`
UncleHash *common.Hash `json:"sha3Uncles" gencodec:"required"` UncleHash *common.Hash `json:"sha3Uncles" gencodec:"required"`
Coinbase *common.Address `json:"miner" gencodec:"required"` Etherbase *common.Address `json:"miner" gencodec:"required"`
Root *common.Hash `json:"stateRoot" gencodec:"required"` Root *common.Hash `json:"stateRoot" gencodec:"required"`
TxHash *common.Hash `json:"transactionsRoot" gencodec:"required"` TxHash *common.Hash `json:"transactionsRoot" gencodec:"required"`
ReceiptHash *common.Hash `json:"receiptsRoot" gencodec:"required"` ReceiptHash *common.Hash `json:"receiptsRoot" gencodec:"required"`
@ -80,10 +80,10 @@ func (h *Header) UnmarshalJSON(input []byte) error {
return errors.New("missing required field 'sha3Uncles' for Header") return errors.New("missing required field 'sha3Uncles' for Header")
} }
h.UncleHash = *dec.UncleHash h.UncleHash = *dec.UncleHash
if dec.Coinbase == nil { if dec.Etherbase == nil {
return errors.New("missing required field 'miner' for Header") return errors.New("missing required field 'miner' for Header")
} }
h.Coinbase = *dec.Coinbase h.Etherbase = *dec.Etherbase
if dec.Root == nil { if dec.Root == nil {
return errors.New("missing required field 'stateRoot' for Header") return errors.New("missing required field 'stateRoot' for Header")
} }

View file

@ -67,7 +67,7 @@ type Context struct {
GasPrice *big.Int // Provides information for GASPRICE GasPrice *big.Int // Provides information for GASPRICE
// Block information // Block information
Coinbase common.Address // Provides information for COINBASE Etherbase common.Address // Provides information for ETHERBASE
GasLimit *big.Int // Provides information for GASLIMIT GasLimit *big.Int // Provides information for GASLIMIT
BlockNumber *big.Int // Provides information for NUMBER BlockNumber *big.Int // Provides information for NUMBER
Time *big.Int // Provides information for TIME Time *big.Int // Provides information for TIME

View file

@ -451,8 +451,8 @@ func opBlockhash(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack
return nil, nil return nil, nil
} }
func opCoinbase(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack *Stack) ([]byte, error) { func opEtherbase(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack *Stack) ([]byte, error) {
stack.push(evm.Coinbase.Big()) stack.push(evm.Etherbase.Big())
return nil, nil return nil, nil
} }

View file

@ -346,8 +346,8 @@ func NewFrontierInstructionSet() [256]operation {
validateStack: makeStackFunc(1, 1), validateStack: makeStackFunc(1, 1),
valid: true, valid: true,
}, },
COINBASE: { ETHERBASE: {
execute: opCoinbase, execute: opEtherbase,
gasCost: constGasFunc(GasQuickStep), gasCost: constGasFunc(GasQuickStep),
validateStack: makeStackFunc(0, 1), validateStack: makeStackFunc(0, 1),
valid: true, valid: true,

View file

@ -89,7 +89,7 @@ const (
const ( const (
// 0x40 range - block operations // 0x40 range - block operations
BLOCKHASH OpCode = 0x40 + iota BLOCKHASH OpCode = 0x40 + iota
COINBASE ETHERBASE
TIMESTAMP TIMESTAMP
NUMBER NUMBER
DIFFICULTY DIFFICULTY
@ -259,7 +259,7 @@ var opCodeToString = map[OpCode]string{
// 0x40 range - block operations // 0x40 range - block operations
BLOCKHASH: "BLOCKHASH", BLOCKHASH: "BLOCKHASH",
COINBASE: "COINBASE", ETHERBASE: "COINBASE",
TIMESTAMP: "TIMESTAMP", TIMESTAMP: "TIMESTAMP",
NUMBER: "NUMBER", NUMBER: "NUMBER",
DIFFICULTY: "DIFFICULTY", DIFFICULTY: "DIFFICULTY",
@ -421,7 +421,7 @@ var stringToOp = map[string]OpCode{
"RETURNDATASIZE": RETURNDATASIZE, "RETURNDATASIZE": RETURNDATASIZE,
"RETURNDATACOPY": RETURNDATACOPY, "RETURNDATACOPY": RETURNDATACOPY,
"BLOCKHASH": BLOCKHASH, "BLOCKHASH": BLOCKHASH,
"COINBASE": COINBASE, "COINBASE": ETHERBASE,
"TIMESTAMP": TIMESTAMP, "TIMESTAMP": TIMESTAMP,
"NUMBER": NUMBER, "NUMBER": NUMBER,
"DIFFICULTY": DIFFICULTY, "DIFFICULTY": DIFFICULTY,

View file

@ -31,7 +31,7 @@ func NewEnv(cfg *Config) *vm.EVM {
GetHash: func(uint64) common.Hash { return common.Hash{} }, GetHash: func(uint64) common.Hash { return common.Hash{} },
Origin: cfg.Origin, Origin: cfg.Origin,
Coinbase: cfg.Coinbase, Etherbase: cfg.Etherbase,
BlockNumber: cfg.BlockNumber, BlockNumber: cfg.BlockNumber,
Time: cfg.Time, Time: cfg.Time,
Difficulty: cfg.Difficulty, Difficulty: cfg.Difficulty,

View file

@ -35,7 +35,7 @@ type Config struct {
ChainConfig *params.ChainConfig ChainConfig *params.ChainConfig
Difficulty *big.Int Difficulty *big.Int
Origin common.Address Origin common.Address
Coinbase common.Address Etherbase common.Address
BlockNumber *big.Int BlockNumber *big.Int
Time *big.Int Time *big.Int
GasLimit uint64 GasLimit uint64

View file

@ -70,7 +70,7 @@ func TestEVM(t *testing.T) {
byte(vm.PUSH1), byte(vm.PUSH1),
byte(vm.ORIGIN), byte(vm.ORIGIN),
byte(vm.BLOCKHASH), byte(vm.BLOCKHASH),
byte(vm.COINBASE), byte(vm.ETHERBASE),
}, nil, nil) }, nil, nil)
} }

View file

@ -62,7 +62,7 @@ type RuntimeData struct {
caller i256 caller i256
origin i256 origin i256
callValue i256 callValue i256
coinBase i256 etherBase i256
difficulty i256 difficulty i256
gasLimit i256 gasLimit i256
number uint64 number uint64
@ -193,7 +193,7 @@ func (self *JitVm) Run(me, caller ContextRef, code []byte, value, gas, price *bi
self.data.caller = address2llvm(caller.Address()) self.data.caller = address2llvm(caller.Address())
self.data.origin = address2llvm(self.env.Origin()) self.data.origin = address2llvm(self.env.Origin())
self.data.callValue = big2llvm(value) self.data.callValue = big2llvm(value)
self.data.coinBase = address2llvm(self.env.Coinbase()) self.data.etherBase = address2llvm(self.env.Etherbase())
self.data.difficulty = big2llvm(self.env.Difficulty()) self.data.difficulty = big2llvm(self.env.Difficulty())
self.data.gasLimit = big2llvm(self.env.GasLimit()) self.data.gasLimit = big2llvm(self.env.GasLimit())
self.data.number = self.env.BlockNumber().Uint64() self.data.number = self.env.BlockNumber().Uint64()

View file

@ -61,11 +61,6 @@ func (api *PublicEthereumAPI) Etherbase() (common.Address, error) {
return api.e.Etherbase() return api.e.Etherbase()
} }
// Coinbase is the address that mining rewards will be send to (alias for Etherbase)
func (api *PublicEthereumAPI) Coinbase() (common.Address, error) {
return api.Etherbase()
}
// Hashrate returns the POW hashrate // Hashrate returns the POW hashrate
func (api *PublicEthereumAPI) Hashrate() hexutil.Uint64 { func (api *PublicEthereumAPI) Hashrate() hexutil.Uint64 {
return hexutil.Uint64(api.e.Miner().HashRate()) return hexutil.Uint64(api.e.Miner().HashRate())

View file

@ -108,7 +108,7 @@ func newTester() *downloadTester {
func (dl *downloadTester) makeChain(n int, seed byte, parent *types.Block, parentReceipts types.Receipts, heavy bool) ([]common.Hash, map[common.Hash]*types.Header, map[common.Hash]*types.Block, map[common.Hash]types.Receipts) { func (dl *downloadTester) makeChain(n int, seed byte, parent *types.Block, parentReceipts types.Receipts, heavy bool) ([]common.Hash, map[common.Hash]*types.Header, map[common.Hash]*types.Block, map[common.Hash]types.Receipts) {
// Generate the block chain // Generate the block chain
blocks, receipts := core.GenerateChain(params.TestChainConfig, parent, dl.peerDb, n, func(i int, block *core.BlockGen) { blocks, receipts := core.GenerateChain(params.TestChainConfig, parent, dl.peerDb, n, func(i int, block *core.BlockGen) {
block.SetCoinbase(common.Address{seed}) block.SetEtherbase(common.Address{seed})
// If a heavy chain is requested, delay blocks to raise difficulty // If a heavy chain is requested, delay blocks to raise difficulty
if heavy { if heavy {

View file

@ -46,7 +46,7 @@ var (
// reassembly. // reassembly.
func makeChain(n int, seed byte, parent *types.Block) ([]common.Hash, map[common.Hash]*types.Block) { func makeChain(n int, seed byte, parent *types.Block) ([]common.Hash, map[common.Hash]*types.Block) {
blocks, _ := core.GenerateChain(params.TestChainConfig, parent, testdb, n, func(i int, block *core.BlockGen) { blocks, _ := core.GenerateChain(params.TestChainConfig, parent, testdb, n, func(i int, block *core.BlockGen) {
block.SetCoinbase(common.Address{seed}) block.SetEtherbase(common.Address{seed})
// If the block number is multiple of 3, send a bonus transaction to the miner // If the block number is multiple of 3, send a bonus transaction to the miner
if parent == genesis && i%3 == 0 { if parent == genesis && i%3 == 0 {

View file

@ -326,7 +326,7 @@ func testGetNodeData(t *testing.T, protocol int) {
block.AddTx(tx2) block.AddTx(tx2)
case 2: case 2:
// Block 3 is empty but was mined by account #2. // Block 3 is empty but was mined by account #2.
block.SetCoinbase(acc2Addr) block.SetEtherbase(acc2Addr)
block.SetExtra([]byte("yeehaw")) block.SetExtra([]byte("yeehaw"))
case 3: case 3:
// Block 4 includes blocks 2 and 3 as uncle headers (with modified extra data). // Block 4 includes blocks 2 and 3 as uncle headers (with modified extra data).
@ -418,7 +418,7 @@ func testGetReceipt(t *testing.T, protocol int) {
block.AddTx(tx2) block.AddTx(tx2)
case 2: case 2:
// Block 3 is empty but was mined by account #2. // Block 3 is empty but was mined by account #2.
block.SetCoinbase(acc2Addr) block.SetEtherbase(acc2Addr)
block.SetExtra([]byte("yeehaw")) block.SetExtra([]byte("yeehaw"))
case 3: case 3:
// Block 4 includes blocks 2 and 3 as uncle headers (with modified extra data). // Block 4 includes blocks 2 and 3 as uncle headers (with modified extra data).

View file

@ -749,7 +749,7 @@ func (s *PublicBlockChainAPI) rpcOutputBlock(b *types.Block, inclTx bool, fullTx
"sha3Uncles": head.UncleHash, "sha3Uncles": head.UncleHash,
"logsBloom": head.Bloom, "logsBloom": head.Bloom,
"stateRoot": head.Root, "stateRoot": head.Root,
"miner": head.Coinbase, "miner": head.Etherbase,
"difficulty": (*hexutil.Big)(head.Difficulty), "difficulty": (*hexutil.Big)(head.Difficulty),
"totalDifficulty": (*hexutil.Big)(s.b.GetTd(b.Hash())), "totalDifficulty": (*hexutil.Big)(s.b.GetTd(b.Hash())),
"extraData": hexutil.Bytes(head.Extra), "extraData": hexutil.Bytes(head.Extra),

View file

@ -5378,8 +5378,8 @@ var methods = function () {
var properties = function () { var properties = function () {
return [ return [
new Property({ new Property({
name: 'coinbase', name: 'etherbase',
getter: 'eth_coinbase' getter: 'eth_etherbase'
}), }),
new Property({ new Property({
name: 'mining', name: 'mining',

View file

@ -137,11 +137,6 @@ func (s *LightDummyAPI) Etherbase() (common.Address, error) {
return common.Address{}, fmt.Errorf("not supported") return common.Address{}, fmt.Errorf("not supported")
} }
// Coinbase is the address that mining rewards will be send to (alias for Etherbase)
func (s *LightDummyAPI) Coinbase() (common.Address, error) {
return common.Address{}, fmt.Errorf("not supported")
}
// Hashrate returns the POW hashrate // Hashrate returns the POW hashrate
func (s *LightDummyAPI) Hashrate() hexutil.Uint { func (s *LightDummyAPI) Hashrate() hexutil.Uint {
return 0 return 0

View file

@ -98,7 +98,7 @@ func testChainGen(i int, block *core.BlockGen) {
block.AddTx(tx3) block.AddTx(tx3)
case 2: case 2:
// Block 3 is empty but was mined by account #2. // Block 3 is empty but was mined by account #2.
block.SetCoinbase(acc2Addr) block.SetEtherbase(acc2Addr)
block.SetExtra([]byte("yeehaw")) block.SetExtra([]byte("yeehaw"))
data := common.Hex2Bytes("C16431B900000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001") data := common.Hex2Bytes("C16431B900000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001")
tx, _ := types.SignTx(types.NewTransaction(block.TxNonce(testBankAddress), testContractAddr, big.NewInt(0), big.NewInt(100000), nil, data), signer, testBankKey) tx, _ := types.SignTx(types.NewTransaction(block.TxNonce(testBankAddress), testContractAddr, big.NewInt(0), big.NewInt(100000), nil, data), signer, testBankKey)

View file

@ -38,7 +38,7 @@ var (
// makeHeaderChain creates a deterministic chain of headers rooted at parent. // makeHeaderChain creates a deterministic chain of headers rooted at parent.
func makeHeaderChain(parent *types.Header, n int, db ethdb.Database, seed int) []*types.Header { func makeHeaderChain(parent *types.Header, n int, db ethdb.Database, seed int) []*types.Header {
blocks, _ := core.GenerateChain(params.TestChainConfig, types.NewBlockWithHeader(parent), db, n, func(i int, b *core.BlockGen) { blocks, _ := core.GenerateChain(params.TestChainConfig, types.NewBlockWithHeader(parent), db, n, func(i int, b *core.BlockGen) {
b.SetCoinbase(common.Address{0: byte(seed), 19: byte(i)}) b.SetEtherbase(common.Address{0: byte(seed), 19: byte(i)})
}) })
headers := make([]*types.Header, len(blocks)) headers := make([]*types.Header, len(blocks))
for i, block := range blocks { for i, block := range blocks {
@ -245,7 +245,7 @@ func makeHeaderChainWithDiff(genesis *types.Block, d []int, seed byte) []*types.
var chain []*types.Header var chain []*types.Header
for i, difficulty := range d { for i, difficulty := range d {
header := &types.Header{ header := &types.Header{
Coinbase: common.Address{seed}, Etherbase: common.Address{seed},
Number: big.NewInt(int64(i + 1)), Number: big.NewInt(int64(i + 1)),
Difficulty: big.NewInt(int64(difficulty)), Difficulty: big.NewInt(int64(difficulty)),
UncleHash: types.EmptyUncleHash, UncleHash: types.EmptyUncleHash,

View file

@ -211,7 +211,7 @@ func testChainGen(i int, block *core.BlockGen) {
block.AddTx(tx3) block.AddTx(tx3)
case 2: case 2:
// Block 3 is empty but was mined by account #2. // Block 3 is empty but was mined by account #2.
block.SetCoinbase(acc2Addr) block.SetEtherbase(acc2Addr)
block.SetExtra([]byte("yeehaw")) block.SetExtra([]byte("yeehaw"))
data := common.Hex2Bytes("C16431B900000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001") data := common.Hex2Bytes("C16431B900000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001")
tx, _ := types.SignTx(types.NewTransaction(block.TxNonce(testBankAddress), testContractAddr, big.NewInt(0), big.NewInt(100000), nil, data), signer, testBankKey) tx, _ := types.SignTx(types.NewTransaction(block.TxNonce(testBankAddress), testContractAddr, big.NewInt(0), big.NewInt(100000), nil, data), signer, testBankKey)

View file

@ -48,7 +48,7 @@ type Miner struct {
worker *worker worker *worker
coinbase common.Address etherbase common.Address
mining int32 mining int32
eth Backend eth Backend
engine consensus.Engine engine consensus.Engine
@ -93,7 +93,7 @@ out:
atomic.StoreInt32(&self.canStart, 1) atomic.StoreInt32(&self.canStart, 1)
atomic.StoreInt32(&self.shouldStart, 0) atomic.StoreInt32(&self.shouldStart, 0)
if shouldStart { if shouldStart {
self.Start(self.coinbase) self.Start(self.etherbase)
} }
// unsubscribe. we're only interested in this event once // unsubscribe. we're only interested in this event once
events.Unsubscribe() events.Unsubscribe()
@ -103,10 +103,10 @@ out:
} }
} }
func (self *Miner) Start(coinbase common.Address) { func (self *Miner) Start(etherbase common.Address) {
atomic.StoreInt32(&self.shouldStart, 1) atomic.StoreInt32(&self.shouldStart, 1)
self.worker.setEtherbase(coinbase) self.worker.setEtherbase(etherbase)
self.coinbase = coinbase self.etherbase = etherbase
if atomic.LoadInt32(&self.canStart) == 0 { if atomic.LoadInt32(&self.canStart) == 0 {
log.Info("Network syncing, will start miner afterwards") log.Info("Network syncing, will start miner afterwards")
@ -178,6 +178,6 @@ func (self *Miner) PendingBlock() *types.Block {
} }
func (self *Miner) SetEtherbase(addr common.Address) { func (self *Miner) SetEtherbase(addr common.Address) {
self.coinbase = addr self.etherbase = addr
self.worker.setEtherbase(addr) self.worker.setEtherbase(addr)
} }

View file

@ -111,7 +111,7 @@ type worker struct {
proc core.Validator proc core.Validator
chainDb ethdb.Database chainDb ethdb.Database
coinbase common.Address etherbase common.Address
extra []byte extra []byte
currentMu sync.Mutex currentMu sync.Mutex
@ -127,7 +127,7 @@ type worker struct {
atWork int32 atWork int32
} }
func newWorker(config *params.ChainConfig, engine consensus.Engine, coinbase common.Address, eth Backend, mux *event.TypeMux) *worker { func newWorker(config *params.ChainConfig, engine consensus.Engine, etherbase common.Address, eth Backend, mux *event.TypeMux) *worker {
worker := &worker{ worker := &worker{
config: config, config: config,
engine: engine, engine: engine,
@ -141,7 +141,7 @@ func newWorker(config *params.ChainConfig, engine consensus.Engine, coinbase com
chain: eth.BlockChain(), chain: eth.BlockChain(),
proc: eth.BlockChain().Validator(), proc: eth.BlockChain().Validator(),
possibleUncles: make(map[common.Hash]*types.Block), possibleUncles: make(map[common.Hash]*types.Block),
coinbase: coinbase, etherbase: etherbase,
agents: make(map[Agent]struct{}), agents: make(map[Agent]struct{}),
unconfirmed: newUnconfirmedBlocks(eth.BlockChain(), miningLogAtDepth), unconfirmed: newUnconfirmedBlocks(eth.BlockChain(), miningLogAtDepth),
} }
@ -161,7 +161,7 @@ func newWorker(config *params.ChainConfig, engine consensus.Engine, coinbase com
func (self *worker) setEtherbase(addr common.Address) { func (self *worker) setEtherbase(addr common.Address) {
self.mu.Lock() self.mu.Lock()
defer self.mu.Unlock() defer self.mu.Unlock()
self.coinbase = addr self.etherbase = addr
} }
func (self *worker) setExtra(extra []byte) { func (self *worker) setExtra(extra []byte) {
@ -267,7 +267,7 @@ func (self *worker) update() {
txs := map[common.Address]types.Transactions{acc: {ev.Tx}} txs := map[common.Address]types.Transactions{acc: {ev.Tx}}
txset := types.NewTransactionsByPriceAndNonce(self.current.signer, txs) txset := types.NewTransactionsByPriceAndNonce(self.current.signer, txs)
self.current.commitTransactions(self.mux, txset, self.chain, self.coinbase) self.current.commitTransactions(self.mux, txset, self.chain, self.etherbase)
self.currentMu.Unlock() self.currentMu.Unlock()
} }
@ -412,9 +412,9 @@ func (self *worker) commitNewWork() {
Extra: self.extra, Extra: self.extra,
Time: big.NewInt(tstamp), Time: big.NewInt(tstamp),
} }
// Only set the coinbase if we are mining (avoid spurious block rewards) // Only set the etherbase if we are mining (avoid spurious block rewards)
if atomic.LoadInt32(&self.mining) == 1 { if atomic.LoadInt32(&self.mining) == 1 {
header.Coinbase = self.coinbase header.Etherbase = self.etherbase
} }
if err := self.engine.Prepare(self.chain, header); err != nil { if err := self.engine.Prepare(self.chain, header); err != nil {
log.Error("Failed to prepare header for mining", "err", err) log.Error("Failed to prepare header for mining", "err", err)
@ -450,7 +450,7 @@ func (self *worker) commitNewWork() {
return return
} }
txs := types.NewTransactionsByPriceAndNonce(self.current.signer, pending) txs := types.NewTransactionsByPriceAndNonce(self.current.signer, pending)
work.commitTransactions(self.mux, txs, self.chain, self.coinbase) work.commitTransactions(self.mux, txs, self.chain, self.etherbase)
// compute uncles for the new block. // compute uncles for the new block.
var ( var (
@ -502,7 +502,7 @@ func (self *worker) commitUncle(work *Work, uncle *types.Header) error {
return nil return nil
} }
func (env *Work) commitTransactions(mux *event.TypeMux, txs *types.TransactionsByPriceAndNonce, bc *core.BlockChain, coinbase common.Address) { func (env *Work) commitTransactions(mux *event.TypeMux, txs *types.TransactionsByPriceAndNonce, bc *core.BlockChain, etherbase common.Address) {
gp := new(core.GasPool).AddGas(env.header.GasLimit) gp := new(core.GasPool).AddGas(env.header.GasLimit)
var coalescedLogs []*types.Log var coalescedLogs []*types.Log
@ -529,7 +529,7 @@ func (env *Work) commitTransactions(mux *event.TypeMux, txs *types.TransactionsB
// Start executing the transaction // Start executing the transaction
env.state.Prepare(tx.Hash(), common.Hash{}, env.tcount) env.state.Prepare(tx.Hash(), common.Hash{}, env.tcount)
err, logs := env.commitTransaction(tx, bc, coinbase, gp) err, logs := env.commitTransaction(tx, bc, etherbase, gp)
switch err { switch err {
case core.ErrGasLimitReached: case core.ErrGasLimitReached:
// Pop the current out-of-gas transaction without shifting in the next from the account // Pop the current out-of-gas transaction without shifting in the next from the account
@ -580,10 +580,10 @@ func (env *Work) commitTransactions(mux *event.TypeMux, txs *types.TransactionsB
} }
} }
func (env *Work) commitTransaction(tx *types.Transaction, bc *core.BlockChain, coinbase common.Address, gp *core.GasPool) (error, []*types.Log) { func (env *Work) commitTransaction(tx *types.Transaction, bc *core.BlockChain, etherbase common.Address, gp *core.GasPool) (error, []*types.Log) {
snap := env.state.Snapshot() snap := env.state.Snapshot()
receipt, _, err := core.ApplyTransaction(env.config, bc, &coinbase, gp, env.state, env.header, tx, env.header.GasUsed, vm.Config{}) receipt, _, err := core.ApplyTransaction(env.config, bc, &etherbase, gp, env.state, env.header, tx, env.header.GasUsed, vm.Config{})
if err != nil { if err != nil {
env.state.RevertToSnapshot(snap) env.state.RevertToSnapshot(snap)
return err, nil return err, nil

View file

@ -105,7 +105,7 @@ func (h *Header) String() string {
func (h *Header) GetParentHash() *Hash { return &Hash{h.header.ParentHash} } func (h *Header) GetParentHash() *Hash { return &Hash{h.header.ParentHash} }
func (h *Header) GetUncleHash() *Hash { return &Hash{h.header.UncleHash} } func (h *Header) GetUncleHash() *Hash { return &Hash{h.header.UncleHash} }
func (h *Header) GetCoinbase() *Address { return &Address{h.header.Coinbase} } func (h *Header) GetEtherbase() *Address { return &Address{h.header.Etherbase} }
func (h *Header) GetRoot() *Hash { return &Hash{h.header.Root} } func (h *Header) GetRoot() *Hash { return &Hash{h.header.Root} }
func (h *Header) GetTxHash() *Hash { return &Hash{h.header.TxHash} } func (h *Header) GetTxHash() *Hash { return &Hash{h.header.TxHash} }
func (h *Header) GetReceiptHash() *Hash { return &Hash{h.header.ReceiptHash} } func (h *Header) GetReceiptHash() *Hash { return &Hash{h.header.ReceiptHash} }
@ -182,7 +182,7 @@ func (b *Block) String() string {
func (b *Block) GetParentHash() *Hash { return &Hash{b.block.ParentHash()} } func (b *Block) GetParentHash() *Hash { return &Hash{b.block.ParentHash()} }
func (b *Block) GetUncleHash() *Hash { return &Hash{b.block.UncleHash()} } func (b *Block) GetUncleHash() *Hash { return &Hash{b.block.UncleHash()} }
func (b *Block) GetCoinbase() *Address { return &Address{b.block.Coinbase()} } func (b *Block) GetEtherbase() *Address { return &Address{b.block.Etherbase()} }
func (b *Block) GetRoot() *Hash { return &Hash{b.block.Root()} } func (b *Block) GetRoot() *Hash { return &Hash{b.block.Root()} }
func (b *Block) GetTxHash() *Hash { return &Hash{b.block.TxHash()} } func (b *Block) GetTxHash() *Hash { return &Hash{b.block.TxHash()} }
func (b *Block) GetReceiptHash() *Hash { return &Hash{b.block.ReceiptHash()} } func (b *Block) GetReceiptHash() *Hash { return &Hash{b.block.ReceiptHash()} }

View file

@ -65,7 +65,7 @@ type btBlock struct {
type btHeader struct { type btHeader struct {
Bloom types.Bloom Bloom types.Bloom
Coinbase common.Address Etherbase common.Address
MixHash common.Hash MixHash common.Hash
Nonce types.BlockNonce Nonce types.BlockNonce
Number *big.Int Number *big.Int
@ -145,7 +145,7 @@ func (t *BlockTest) genesis(config *params.ChainConfig) *core.Genesis {
GasUsed: t.json.Genesis.GasUsed.Uint64(), GasUsed: t.json.Genesis.GasUsed.Uint64(),
Difficulty: t.json.Genesis.Difficulty, Difficulty: t.json.Genesis.Difficulty,
Mixhash: t.json.Genesis.MixHash, Mixhash: t.json.Genesis.MixHash,
Coinbase: t.json.Genesis.Coinbase, Etherbase: t.json.Genesis.Etherbase,
Alloc: t.json.Pre, Alloc: t.json.Pre,
} }
} }
@ -201,8 +201,8 @@ func validateHeader(h *btHeader, h2 *types.Header) error {
if h.Bloom != h2.Bloom { if h.Bloom != h2.Bloom {
return fmt.Errorf("Bloom: want: %x have: %x", h.Bloom, h2.Bloom) return fmt.Errorf("Bloom: want: %x have: %x", h.Bloom, h2.Bloom)
} }
if h.Coinbase != h2.Coinbase { if h.Etherbase != h2.Etherbase {
return fmt.Errorf("Coinbase: want: %x have: %x", h.Coinbase, h2.Coinbase) return fmt.Errorf("Etherbase: want: %x have: %x", h.Etherbase, h2.Etherbase)
} }
if h.MixHash != h2.MixDigest { if h.MixHash != h2.MixDigest {
return fmt.Errorf("MixHash: want: %x have: %x", h.MixHash, h2.MixDigest) return fmt.Errorf("MixHash: want: %x have: %x", h.MixHash, h2.MixDigest)

View file

@ -17,7 +17,7 @@ var _ = (*btHeaderMarshaling)(nil)
func (b btHeader) MarshalJSON() ([]byte, error) { func (b btHeader) MarshalJSON() ([]byte, error) {
type btHeader struct { type btHeader struct {
Bloom types.Bloom Bloom types.Bloom
Coinbase common.Address Etherbase common.Address
MixHash common.Hash MixHash common.Hash
Nonce types.BlockNonce Nonce types.BlockNonce
Number *math.HexOrDecimal256 Number *math.HexOrDecimal256
@ -35,7 +35,7 @@ func (b btHeader) MarshalJSON() ([]byte, error) {
} }
var enc btHeader var enc btHeader
enc.Bloom = b.Bloom enc.Bloom = b.Bloom
enc.Coinbase = b.Coinbase enc.Etherbase = b.Etherbase
enc.MixHash = b.MixHash enc.MixHash = b.MixHash
enc.Nonce = b.Nonce enc.Nonce = b.Nonce
enc.Number = (*math.HexOrDecimal256)(b.Number) enc.Number = (*math.HexOrDecimal256)(b.Number)
@ -56,7 +56,7 @@ func (b btHeader) MarshalJSON() ([]byte, error) {
func (b *btHeader) UnmarshalJSON(input []byte) error { func (b *btHeader) UnmarshalJSON(input []byte) error {
type btHeader struct { type btHeader struct {
Bloom *types.Bloom Bloom *types.Bloom
Coinbase *common.Address Etherbase *common.Address
MixHash *common.Hash MixHash *common.Hash
Nonce *types.BlockNonce Nonce *types.BlockNonce
Number *math.HexOrDecimal256 Number *math.HexOrDecimal256
@ -79,8 +79,8 @@ func (b *btHeader) UnmarshalJSON(input []byte) error {
if dec.Bloom != nil { if dec.Bloom != nil {
b.Bloom = *dec.Bloom b.Bloom = *dec.Bloom
} }
if dec.Coinbase != nil { if dec.Etherbase != nil {
b.Coinbase = *dec.Coinbase b.Etherbase = *dec.Etherbase
} }
if dec.MixHash != nil { if dec.MixHash != nil {
b.MixHash = *dec.MixHash b.MixHash = *dec.MixHash

View file

@ -15,14 +15,14 @@ var _ = (*stEnvMarshaling)(nil)
func (s stEnv) MarshalJSON() ([]byte, error) { func (s stEnv) MarshalJSON() ([]byte, error) {
type stEnv struct { type stEnv struct {
Coinbase common.UnprefixedAddress `json:"currentCoinbase" gencodec:"required"` Etherbase common.UnprefixedAddress `json:"currentCoinbase" gencodec:"required"`
Difficulty *math.HexOrDecimal256 `json:"currentDifficulty" gencodec:"required"` Difficulty *math.HexOrDecimal256 `json:"currentDifficulty" gencodec:"required"`
GasLimit *math.HexOrDecimal256 `json:"currentGasLimit" gencodec:"required"` GasLimit *math.HexOrDecimal256 `json:"currentGasLimit" gencodec:"required"`
Number math.HexOrDecimal64 `json:"currentNumber" gencodec:"required"` Number math.HexOrDecimal64 `json:"currentNumber" gencodec:"required"`
Timestamp math.HexOrDecimal64 `json:"currentTimestamp" gencodec:"required"` Timestamp math.HexOrDecimal64 `json:"currentTimestamp" gencodec:"required"`
} }
var enc stEnv var enc stEnv
enc.Coinbase = common.UnprefixedAddress(s.Coinbase) enc.Etherbase = common.UnprefixedAddress(s.Etherbase)
enc.Difficulty = (*math.HexOrDecimal256)(s.Difficulty) enc.Difficulty = (*math.HexOrDecimal256)(s.Difficulty)
enc.GasLimit = (*math.HexOrDecimal256)(s.GasLimit) enc.GasLimit = (*math.HexOrDecimal256)(s.GasLimit)
enc.Number = math.HexOrDecimal64(s.Number) enc.Number = math.HexOrDecimal64(s.Number)
@ -32,7 +32,7 @@ func (s stEnv) MarshalJSON() ([]byte, error) {
func (s *stEnv) UnmarshalJSON(input []byte) error { func (s *stEnv) UnmarshalJSON(input []byte) error {
type stEnv struct { type stEnv struct {
Coinbase *common.UnprefixedAddress `json:"currentCoinbase" gencodec:"required"` Etherbase *common.UnprefixedAddress `json:"currentCoinbase" gencodec:"required"`
Difficulty *math.HexOrDecimal256 `json:"currentDifficulty" gencodec:"required"` Difficulty *math.HexOrDecimal256 `json:"currentDifficulty" gencodec:"required"`
GasLimit *math.HexOrDecimal256 `json:"currentGasLimit" gencodec:"required"` GasLimit *math.HexOrDecimal256 `json:"currentGasLimit" gencodec:"required"`
Number *math.HexOrDecimal64 `json:"currentNumber" gencodec:"required"` Number *math.HexOrDecimal64 `json:"currentNumber" gencodec:"required"`
@ -42,10 +42,10 @@ func (s *stEnv) UnmarshalJSON(input []byte) error {
if err := json.Unmarshal(input, &dec); err != nil { if err := json.Unmarshal(input, &dec); err != nil {
return err return err
} }
if dec.Coinbase == nil { if dec.Etherbase == nil {
return errors.New("missing required field 'currentCoinbase' for stEnv") return errors.New("missing required field 'currentCoinbase' for stEnv")
} }
s.Coinbase = common.Address(*dec.Coinbase) s.Etherbase = common.Address(*dec.Etherbase)
if dec.Difficulty == nil { if dec.Difficulty == nil {
return errors.New("missing required field 'currentDifficulty' for stEnv") return errors.New("missing required field 'currentDifficulty' for stEnv")
} }

View file

@ -74,7 +74,7 @@ type stPostState struct {
//go:generate gencodec -type stEnv -field-override stEnvMarshaling -out gen_stenv.go //go:generate gencodec -type stEnv -field-override stEnvMarshaling -out gen_stenv.go
type stEnv struct { type stEnv struct {
Coinbase common.Address `json:"currentCoinbase" gencodec:"required"` Etherbase common.Address `json:"currentCoinbase" gencodec:"required"`
Difficulty *big.Int `json:"currentDifficulty" gencodec:"required"` Difficulty *big.Int `json:"currentDifficulty" gencodec:"required"`
GasLimit *big.Int `json:"currentGasLimit" gencodec:"required"` GasLimit *big.Int `json:"currentGasLimit" gencodec:"required"`
Number uint64 `json:"currentNumber" gencodec:"required"` Number uint64 `json:"currentNumber" gencodec:"required"`
@ -82,7 +82,7 @@ type stEnv struct {
} }
type stEnvMarshaling struct { type stEnvMarshaling struct {
Coinbase common.UnprefixedAddress Etherbase common.UnprefixedAddress
Difficulty *math.HexOrDecimal256 Difficulty *math.HexOrDecimal256
GasLimit *math.HexOrDecimal256 GasLimit *math.HexOrDecimal256
Number math.HexOrDecimal64 Number math.HexOrDecimal64
@ -134,7 +134,7 @@ func (t *StateTest) Run(subtest StateSubtest, vmconfig vm.Config) (*state.StateD
if err != nil { if err != nil {
return nil, err return nil, err
} }
context := core.NewEVMContext(msg, block.Header(), nil, &t.json.Env.Coinbase) context := core.NewEVMContext(msg, block.Header(), nil, &t.json.Env.Etherbase)
context.GetHash = vmTestBlockHash context.GetHash = vmTestBlockHash
evm := vm.NewEVM(context, statedb, config, vmconfig) evm := vm.NewEVM(context, statedb, config, vmconfig)
@ -178,7 +178,7 @@ func makePreState(db ethdb.Database, accounts core.GenesisAlloc) *state.StateDB
func (t *StateTest) genesis(config *params.ChainConfig) *core.Genesis { func (t *StateTest) genesis(config *params.ChainConfig) *core.Genesis {
return &core.Genesis{ return &core.Genesis{
Config: config, Config: config,
Coinbase: t.json.Env.Coinbase, Etherbase: t.json.Env.Etherbase,
Difficulty: t.json.Env.Difficulty, Difficulty: t.json.Env.Difficulty,
GasLimit: t.json.Env.GasLimit.Uint64(), GasLimit: t.json.Env.GasLimit.Uint64(),
Number: t.json.Env.Number, Number: t.json.Env.Number,

View file

@ -136,7 +136,7 @@ func (t *VMTest) newEVM(statedb *state.StateDB, vmconfig vm.Config) *vm.EVM {
Transfer: transfer, Transfer: transfer,
GetHash: vmTestBlockHash, GetHash: vmTestBlockHash,
Origin: t.json.Exec.Origin, Origin: t.json.Exec.Origin,
Coinbase: t.json.Env.Coinbase, Etherbase: t.json.Env.Etherbase,
BlockNumber: new(big.Int).SetUint64(t.json.Env.Number), BlockNumber: new(big.Int).SetUint64(t.json.Env.Number),
Time: new(big.Int).SetUint64(t.json.Env.Timestamp), Time: new(big.Int).SetUint64(t.json.Env.Timestamp),
GasLimit: t.json.Env.GasLimit, GasLimit: t.json.Env.GasLimit,