clean up code

pull/111/head
Minh Doan 6 years ago
parent bb194a2c3d
commit 8902365c45
  1. 7
      client/txgen/main.go
  2. 3
      client/txgen/txgen/account_txs_generator.go
  3. 3
      client/txgen/txgen/utxo_txs_generator.go
  4. 9
      node/node.go
  5. 5
      node/worker/worker.go
  6. 3
      proto/node/node.go
  7. 7
      trie/database.go

@ -3,15 +3,16 @@ package main
import (
"flag"
"fmt"
"github.com/ethereum/go-ethereum/rlp"
"github.com/harmony-one/harmony/client/txgen/txgen"
"github.com/harmony-one/harmony/core/types"
"os"
"path"
"runtime"
"sync"
"time"
"github.com/ethereum/go-ethereum/rlp"
"github.com/harmony-one/harmony/client/txgen/txgen"
"github.com/harmony-one/harmony/core/types"
"github.com/harmony-one/harmony/blockchain"
"github.com/harmony-one/harmony/client"
client_config "github.com/harmony-one/harmony/client/config"

@ -1,11 +1,12 @@
package txgen
import (
"math/big"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/params"
"github.com/harmony-one/harmony/core/types"
"github.com/harmony-one/harmony/node"
"math/big"
)
type TxGenSettings struct {

@ -3,12 +3,13 @@ package txgen
import (
"encoding/binary"
"encoding/hex"
"math/rand"
"github.com/harmony-one/harmony/blockchain"
"github.com/harmony-one/harmony/client"
"github.com/harmony-one/harmony/crypto/pki"
"github.com/harmony-one/harmony/log"
"github.com/harmony-one/harmony/node"
"math/rand"
)
type TxInfo struct {

@ -27,7 +27,6 @@ import (
"github.com/harmony-one/harmony/log"
"github.com/harmony-one/harmony/node/worker"
"github.com/harmony-one/harmony/p2p"
proto_identity "github.com/harmony-one/harmony/proto/identity"
proto_node "github.com/harmony-one/harmony/proto/node"
"github.com/harmony-one/harmony/syncing/downloader"
downloader_pb "github.com/harmony-one/harmony/syncing/downloader/proto"
@ -216,14 +215,6 @@ func (node *Node) countNumTransactionsInBlockchainAccount() int {
return count
}
//ConnectBeaconChain connects to identity chain
func (node *Node) ConnectBeaconChain() {
Nnode := &NetworkNode{SelfPeer: node.SelfPeer, IDCPeer: node.IDCPeer}
msg := node.SerializeNode(Nnode)
msgToSend := proto_identity.ConstructIdentityMessage(proto_identity.Register, msg)
p2p.SendMessage(node.IDCPeer, msgToSend)
}
// SerializeNode serializes the node
// https://stackoverflow.com/questions/12854125/how-do-i-dump-the-struct-into-the-byte-array-without-reflection/12854659#12854659
func (node *Node) SerializeNode(nnode *NetworkNode) []byte {

@ -1,6 +1,9 @@
package worker
import (
"math/big"
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/params"
"github.com/harmony-one/harmony/consensus"
@ -8,8 +11,6 @@ import (
"github.com/harmony-one/harmony/core/state"
"github.com/harmony-one/harmony/core/types"
"github.com/harmony-one/harmony/core/vm"
"math/big"
"time"
)
// environment is the worker's current environment and holds all of the current state information.

@ -4,9 +4,10 @@ import (
"bytes"
"encoding/gob"
"fmt"
"log"
"github.com/ethereum/go-ethereum/rlp"
"github.com/harmony-one/harmony/core/types"
"log"
"github.com/harmony-one/harmony/blockchain"
"github.com/harmony-one/harmony/p2p"

@ -18,14 +18,15 @@ package trie
import (
"fmt"
"io"
"sync"
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/rlp"
hdb "github.com/harmony-one/harmony/db"
"io"
"sync"
"time"
)
var (

Loading…
Cancel
Save