clean up formatting

This commit is contained in:
Tim Williams 2018-08-13 14:45:01 -04:00
parent 2432128b60
commit 0424770010

View file

@ -4,19 +4,19 @@ package main
//to run server 'go run shyftRingWalletConn/*.go' //to run server 'go run shyftRingWalletConn/*.go'
import ( import (
"bufio" "bufio"
"context"
"fmt" "fmt"
"github.com/ShyftNetwork/go-empyrean/common"
"github.com/ShyftNetwork/go-empyrean/common/hexutil" "github.com/ShyftNetwork/go-empyrean/common/hexutil"
"github.com/ShyftNetwork/go-empyrean/core/types"
"github.com/ShyftNetwork/go-empyrean/crypto" "github.com/ShyftNetwork/go-empyrean/crypto"
"github.com/ShyftNetwork/go-empyrean/ethclient"
"github.com/ShyftNetwork/go-empyrean/rlp"
"io" "io"
"net" "net"
"net/http" "net/http"
"os" "os"
"github.com/ShyftNetwork/go-empyrean/ethclient"
"github.com/ShyftNetwork/go-empyrean/common"
"context"
"sync" "sync"
"github.com/ShyftNetwork/go-empyrean/core/types"
"github.com/ShyftNetwork/go-empyrean/rlp"
) )
const ( const (
@ -66,7 +66,6 @@ func handleRequest(conn net.Conn) {
checkBalanceChan := make(chan []byte) checkBalanceChan := make(chan []byte)
sendTransactionChan := make(chan []byte) sendTransactionChan := make(chan []byte)
go readerConn(conn, messages) go readerConn(conn, messages)
go handleMessages(messages, checkBalanceChan, sendTransactionChan) go handleMessages(messages, checkBalanceChan, sendTransactionChan)
go checkBalance(checkBalanceChan, conn) go checkBalance(checkBalanceChan, conn)
@ -161,15 +160,14 @@ func readerConn(conn net.Conn, channel chan []byte) {
func checkBalance(checkBalanceChan chan []byte, conn net.Conn) { func checkBalance(checkBalanceChan chan []byte, conn net.Conn) {
c, err := ethclient.Dial("http://127.0.0.1:8545") c, err := ethclient.Dial("http://127.0.0.1:8545")
if err != nil { if err != nil {
fmt.Println("Eth Client not initialized: " , err) fmt.Println("Eth Client not initialized: ", err)
} }
for { for {
address := <-checkBalanceChan address := <-checkBalanceChan
fmt.Println("the address is ", string(address[:])) fmt.Println("the address is ", string(address[:]))
balance, error := c.BalanceAt(context.Background(), common.HexToAddress(string(address[:])), nil)
balance, error := c.BalanceAt(context.Background(), common.HexToAddress(string(address[:])),nil)
if error != nil { if error != nil {
fmt.Println("Balance at error ", error) fmt.Println("Balance at error ", error)
} }
@ -186,7 +184,7 @@ func checkBalance(checkBalanceChan chan []byte, conn net.Conn) {
func sendTransaction(sendTransactionChan chan []byte) { func sendTransaction(sendTransactionChan chan []byte) {
c, err := ethclient.Dial("http://127.0.0.1:8545") c, err := ethclient.Dial("http://127.0.0.1:8545")
if err != nil { if err != nil {
fmt.Println("Eth Client not initialized: " , err) fmt.Println("Eth Client not initialized: ", err)
} }
for { for {
@ -203,7 +201,7 @@ func sendTransaction(sendTransactionChan chan []byte) {
} }
} }
func sendRingSignedMsg(conn net.Conn){ func sendRingSignedMsg(conn net.Conn) {
key, _ := crypto.HexToECDSA(testPrivHex) key, _ := crypto.HexToECDSA(testPrivHex)
f_msg := "Hello World" f_msg := "Hello World"