diff --git a/.gitignore b/.gitignore index d4d4c9e7b..215378e33 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,6 @@ profile.cov # vagrant .vagrant + +# tests +src/.ethereumtest/ diff --git a/src/gethdep_test.go b/src/gethdep_test.go index 4aa88b6cc..88fb94f0c 100644 --- a/src/gethdep_test.go +++ b/src/gethdep_test.go @@ -20,6 +20,7 @@ import ( // TestAccountBindings makes sure we can create an account and subsequently // unlock that account func TestAccountBindings(t *testing.T) { + rpcport = 8546 // in order to avoid conflicts with running react-native app // start geth node and wait for it to initialize go createAndStartNode(".ethereumtest") @@ -99,6 +100,12 @@ func TestAccountBindings(t *testing.T) { sentinel = 1 }) + // try completing non-existing transaction + if err := completeTransaction("0x1234512345123451234512345123456123451234512345123451234512345123"); err == nil { + t.Errorf("Test failed: error expected and not recieved") + } + + // send normal transaction from, err := utils.MakeAddress(accountManager, address1) if err != nil { t.Errorf("Test failed: Could not retrieve account from address: %v", err) diff --git a/src/main.go b/src/main.go index e2d3cd3d2..305681b37 100644 --- a/src/main.go +++ b/src/main.go @@ -15,9 +15,9 @@ import ( "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/release" "github.com/ethereum/go-ethereum/rlp" + "github.com/ethereum/go-ethereum/rpc" "github.com/ethereum/go-ethereum/whisper" "gopkg.in/urfave/cli.v1" - "github.com/ethereum/go-ethereum/rpc" ) const ( @@ -31,15 +31,16 @@ const ( ) var ( - vString string // Combined textual representation of the version - rConfig release.Config // Structured version information and release oracle config - currentNode *node.Node // currently running geth node - c *cli.Context // the CLI context used to start the geth node - accountSync *[]node.Service // the object used to sync accounts between geth services - lightEthereum *les.LightEthereum // LES service - accountManager *accounts.Manager // the account manager attached to the currentNode - whisperService *whisper.Whisper // whisper service - datadir string // data directory for geth + vString string // Combined textual representation of the version + rConfig release.Config // Structured version information and release oracle config + currentNode *node.Node // currently running geth node + c *cli.Context // the CLI context used to start the geth node + accountSync *[]node.Service // the object used to sync accounts between geth services + lightEthereum *les.LightEthereum // LES service + accountManager *accounts.Manager // the account manager attached to the currentNode + whisperService *whisper.Whisper // whisper service + datadir string // data directory for geth + rpcport int = 8545 // RPC port (replaced in unit tests) client rpc.Client ) @@ -63,7 +64,7 @@ func MakeNode(inputDir string) *node.Node { set.Bool("testnet", true, "light test network") set.Bool("rpc", true, "enable rpc") set.String("rpcaddr", "localhost", "host for RPC") - set.String("rpcport", "8545", "rpc port") + set.Int("rpcport", rpcport, "rpc port") set.String("rpccorsdomain", "*", "allow all domains") set.String("verbosity", "3", "verbosity level") set.String("rpcapi", "db,eth,net,web3,shh,personal,admin", "rpc api(s)") diff --git a/src/vendor/github.com/ethereum/go-ethereum/les/status_backend.go b/src/vendor/github.com/ethereum/go-ethereum/les/status_backend.go index 90ce704a8..ad81891f6 100644 --- a/src/vendor/github.com/ethereum/go-ethereum/les/status_backend.go +++ b/src/vendor/github.com/ethereum/go-ethereum/les/status_backend.go @@ -9,11 +9,18 @@ import ( "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/rpc" + "errors" ) -const defaultTxQueueCap = int(5) -const defaultEvictingTxQueueCap = int(20) -const defaultEvictingTxQueueEvictionStep = int(5) // how many item to evict in a single run +const ( + defaultTxQueueCap = int(5) // how many items can be passed to sendTransaction() w/o blocking + defaultEvictingTxQueueCap = int(20) // how many items can be queued + defaultEvictingTxQueueEvictionStep = int(5) // how many item to evict in a single run +) + +var ( + ErrQueuedTxHashNotFound = errors.New("Transaction hash not found") +) // StatusBackend implements les.StatusBackend with direct calls to Ethereum // internals to support calls from status-go bindings (to internal packages e.g. ethapi) @@ -113,7 +120,7 @@ func (b *StatusBackend) GetTransactionQueue() (chan QueuedTx, error) { func (b *StatusBackend) transactionQueueForwardingLoop() { txQueue, err := b.txapi.GetTransactionQueue() if err != nil { - glog.V(logger.Error).Infof("Cannot read from transaction queue") + glog.V(logger.Error).Infof("cannot read from transaction queue") return } @@ -158,5 +165,5 @@ func (q *evictingTxQueue) getQueuedTransaction(hash QueuedTxHash) (*QueuedTx, er return tx, nil } - return nil, nil + return nil, ErrQueuedTxHashNotFound }