From a2919b5e17197afcb689b8f4144f255a5872f85d Mon Sep 17 00:00:00 2001 From: obscuren Date: Sun, 10 May 2015 23:12:18 +0200 Subject: core, eth, miner: improved tx removal & fatal error on db sync err * core: Added GasPriceChange event * eth: When one of the DB flush methods error a fatal error log message is given. Hopefully this will prevent corrupted databases from occuring. * miner: remove transactions with low gas price. Closes #906, #903 --- core/events.go | 6 +++++- core/manager.go | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'core') diff --git a/core/events.go b/core/events.go index 3da668af5..1ea35c2f4 100644 --- a/core/events.go +++ b/core/events.go @@ -1,8 +1,10 @@ package core import ( - "github.com/ethereum/go-ethereum/core/types" + "math/big" + "github.com/ethereum/go-ethereum/core/state" + "github.com/ethereum/go-ethereum/core/types" ) // TxPreEvent is posted when a transaction enters the transaction pool. @@ -44,6 +46,8 @@ type ChainUncleEvent struct { type ChainHeadEvent struct{ Block *types.Block } +type GasPriceChanged struct{ Price *big.Int } + // Mining operation events type StartMining struct{} type TopMining struct{} diff --git a/core/manager.go b/core/manager.go index 9b5407a9e..433ada7ee 100644 --- a/core/manager.go +++ b/core/manager.go @@ -1,12 +1,14 @@ package core import ( + "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/p2p" ) type Backend interface { + AccountManager() *accounts.Manager BlockProcessor() *BlockProcessor ChainManager() *ChainManager TxPool() *TxPool -- cgit v1.2.3 From 3c6c89168049fbcffa0a02690c27c324f6f0264d Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 11 May 2015 01:28:15 +0200 Subject: core: optimise pending transaction processing --- core/transaction_pool.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core') diff --git a/core/transaction_pool.go b/core/transaction_pool.go index 6898a4bda..e68f7406a 100644 --- a/core/transaction_pool.go +++ b/core/transaction_pool.go @@ -21,7 +21,7 @@ var ( ErrInvalidSender = errors.New("Invalid sender") ErrNonce = errors.New("Nonce too low") ErrBalance = errors.New("Insufficient balance") - ErrNonExistentAccount = errors.New("Account does not exist") + ErrNonExistentAccount = errors.New("Account does not exist or account balance too low") ErrInsufficientFunds = errors.New("Insufficient funds for gas * price + value") ErrIntrinsicGas = errors.New("Intrinsic gas too low") ErrGasLimit = errors.New("Exceeds block gas limit") -- cgit v1.2.3 From b79dd188d916da7adbf448dc27b0c59a04e0938d Mon Sep 17 00:00:00 2001 From: Bas van Kervel Date: Tue, 12 May 2015 14:24:11 +0200 Subject: replaced several path.* with filepath.* which is platform independent --- core/chain_manager_test.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'core') diff --git a/core/chain_manager_test.go b/core/chain_manager_test.go index 50915459b..d6aa22a48 100644 --- a/core/chain_manager_test.go +++ b/core/chain_manager_test.go @@ -4,11 +4,12 @@ import ( "fmt" "math/big" "os" - "path" "runtime" "strconv" "testing" + "path/filepath" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/types" @@ -94,7 +95,7 @@ func testChain(chainB types.Blocks, bman *BlockProcessor) (*big.Int, error) { } func loadChain(fn string, t *testing.T) (types.Blocks, error) { - fh, err := os.OpenFile(path.Join(os.Getenv("GOPATH"), "src", "github.com", "ethereum", "go-ethereum", "_data", fn), os.O_RDONLY, os.ModePerm) + fh, err := os.OpenFile(filepath.Join(os.Getenv("GOPATH"), "src", "github.com", "ethereum", "go-ethereum", "_data", fn), os.O_RDONLY, os.ModePerm) if err != nil { return nil, err } -- cgit v1.2.3 From 95773b9673ac78fdceb152d1dd2528f90e8a02b7 Mon Sep 17 00:00:00 2001 From: Bas van Kervel Date: Tue, 12 May 2015 15:20:53 +0200 Subject: removed redundant newlines in import block --- core/chain_manager_test.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'core') diff --git a/core/chain_manager_test.go b/core/chain_manager_test.go index d6aa22a48..f456e4fff 100644 --- a/core/chain_manager_test.go +++ b/core/chain_manager_test.go @@ -4,12 +4,11 @@ import ( "fmt" "math/big" "os" + "path/filepath" "runtime" "strconv" "testing" - "path/filepath" - "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/types" -- cgit v1.2.3