|
|
|
@ -22,7 +22,7 @@ type Node struct { |
|
|
|
|
pendingTransactions []*blockchain.Transaction // All the transactions received but not yet processed for Consensus
|
|
|
|
|
transactionInConsensus []*blockchain.Transaction // The transactions selected into the new block and under Consensus process
|
|
|
|
|
blockchain *blockchain.Blockchain // The blockchain for the shard where this node belongs
|
|
|
|
|
DB *db.LDBDatabase // LevelDB to store blockchain.
|
|
|
|
|
db *db.LDBDatabase // LevelDB to store blockchain.
|
|
|
|
|
UtxoPool *blockchain.UTXOPool // The corresponding UTXO pool of the current blockchain
|
|
|
|
|
CrossTxsInConsensus []*blockchain.CrossShardTxAndProof // The cross shard txs that is under consensus, the proof is not filled yet.
|
|
|
|
|
CrossTxsToReturn []*blockchain.CrossShardTxAndProof // The cross shard txs and proof that needs to be sent back to the user client.
|
|
|
|
@ -97,7 +97,7 @@ func (node *Node) countNumTransactionsInBlockchain() int { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Create a new Node
|
|
|
|
|
func New(consensus *consensus.Consensus, dbSupported bool) *Node { |
|
|
|
|
func New(consensus *consensus.Consensus, db *db.LDBDatabase) *Node { |
|
|
|
|
node := Node{} |
|
|
|
|
|
|
|
|
|
// Consensus and associated channel to communicate blocks
|
|
|
|
@ -119,15 +119,8 @@ func New(consensus *consensus.Consensus, dbSupported bool) *Node { |
|
|
|
|
// Logger
|
|
|
|
|
node.log = node.Consensus.Log |
|
|
|
|
|
|
|
|
|
// // Initialize leveldb
|
|
|
|
|
// if dbSupported {
|
|
|
|
|
// // TODO(minhdoan): Refactor this.
|
|
|
|
|
// var err = os.Remove("/tmp/harmony_db.dat")
|
|
|
|
|
// if err != nil {
|
|
|
|
|
// fmt.Println(err.Error())
|
|
|
|
|
// os.Exit(1)
|
|
|
|
|
// }
|
|
|
|
|
// node.db, _ = db.NewLDBDatabase("/tmp/harmony_db.dat", 0, 0)
|
|
|
|
|
// }
|
|
|
|
|
// Initialize level db.
|
|
|
|
|
node.db = db |
|
|
|
|
|
|
|
|
|
return &node |
|
|
|
|
} |
|
|
|
|