Merge pull request #173 from harmony-one/rj_branch

Fix build error by removing legacy reference
pull/174/head
Rongjian Lan 6 years ago committed by GitHub
commit ff7164a824
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 38
      client/client.go
  2. 5
      services/syncing/syncing.go

@ -2,9 +2,6 @@ package client
import (
"github.com/harmony-one/harmony/core/types"
"github.com/simple-rules/harmony-benchmark/blockchain"
"sync"
"github.com/harmony-one/harmony/log"
"github.com/harmony-one/harmony/p2p"
"github.com/harmony-one/harmony/p2p/host"
@ -15,9 +12,7 @@ type Client struct {
Leaders *map[uint32]p2p.Peer // Map of shard Id and corresponding leader
UpdateBlocks func([]*types.Block) // Closure function used to sync new block with the leader. Once the leader finishes the consensus on a new block, it will send it to the clients. Clients use this method to update their blockchain
ShardUtxoMap map[uint32]blockchain.UtxoMap
ShardUtxoMapMutex sync.Mutex // Mutex for the UTXO maps
log log.Logger // Log utility
log log.Logger // Log utility
// The p2p host used to send/receive p2p messages
host host.Host
@ -33,37 +28,6 @@ func NewClient(host host.Host, leaders *map[uint32]p2p.Peer) *Client {
return &client
}
// BuildOutputShardTransactionMap builds output shard transaction map.
func BuildOutputShardTransactionMap(txs []*blockchain.Transaction) map[uint32][]*blockchain.Transaction {
txsShardMap := make(map[uint32][]*blockchain.Transaction)
// Put txs into corresponding output shards
for _, crossTx := range txs {
for curShardID := range GetOutputShardIDsOfCrossShardTx(crossTx) {
txsShardMap[curShardID] = append(txsShardMap[curShardID], crossTx)
}
}
return txsShardMap
}
// GetInputShardIDsOfCrossShardTx gets input shardID.
func GetInputShardIDsOfCrossShardTx(crossTx *blockchain.Transaction) map[uint32]bool {
shardIDs := map[uint32]bool{}
for _, txInput := range crossTx.TxInput {
shardIDs[txInput.ShardID] = true
}
return shardIDs
}
// GetOutputShardIDsOfCrossShardTx gets output shard ids.
func GetOutputShardIDsOfCrossShardTx(crossTx *blockchain.Transaction) map[uint32]bool {
shardIDs := map[uint32]bool{}
for _, txOutput := range crossTx.TxOutput {
shardIDs[txOutput.ShardID] = true
}
return shardIDs
}
// GetLeaders returns leader peers.
func (client *Client) GetLeaders() []p2p.Peer {
leaders := []p2p.Peer{}

@ -3,7 +3,6 @@ package syncing
import (
"bytes"
"github.com/harmony-one/harmony/core"
"github.com/simple-rules/harmony-benchmark/blockchain"
"reflect"
"sort"
"sync"
@ -295,12 +294,12 @@ func (ss *StateSync) downloadBlocks(bc *core.BlockChain) {
syncTask := task[0].(SyncBlockTask)
for {
//id := syncTask.index
payload, err := peerConfig.GetBlocks([][]byte{syncTask.blockHash})
_, err := peerConfig.GetBlocks([][]byte{syncTask.blockHash})
if err == nil {
// As of now, only send and ask for one block.
// TODO (minh) rework the syncing for account model.
//bc.Blocks[id], err = blockchain.DeserializeBlock(payload[0])
_, err = blockchain.DeserializeBlock(payload[0])
//_, err = blockchain.DeserializeBlock(payload[0])
if err == nil {
break
}

Loading…
Cancel
Save