diff --git a/node/node.go b/node/node.go index 986a1d18c..72a061370 100644 --- a/node/node.go +++ b/node/node.go @@ -5,15 +5,16 @@ import ( "encoding/gob" "fmt" "github.com/harmony-one/harmony/core" + "github.com/harmony-one/harmony/core/vm" "net" "sync" "time" "github.com/harmony-one/harmony/blockchain" "github.com/harmony-one/harmony/client" - "github.com/harmony-one/harmony/consensus" + bft "github.com/harmony-one/harmony/consensus" "github.com/harmony-one/harmony/crypto/pki" - "github.com/harmony-one/harmony/db" + hdb "github.com/harmony-one/harmony/db" "github.com/harmony-one/harmony/log" "github.com/harmony-one/harmony/p2p" proto_identity "github.com/harmony-one/harmony/proto/identity" @@ -27,12 +28,12 @@ type NetworkNode struct { // Node represents a program (machine) participating in the network // TODO(minhdoan, rj): consider using BlockChannel *chan blockchain.Block for efficiency. type Node struct { - Consensus *consensus.Consensus // Consensus object containing all Consensus related data (e.g. committee members, signatures, commits) + Consensus *bft.Consensus // Consensus object containing all Consensus related data (e.g. committee members, signatures, commits) BlockChannel chan blockchain.Block // The channel to receive new blocks from Node 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 *hdb.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. @@ -171,7 +172,7 @@ func DeserializeNode(d []byte) *NetworkNode { } // New creates a new node. -func New(consensus *consensus.Consensus, db *db.LDBDatabase) *Node { +func New(consensus *bft.Consensus, db *hdb.LDBDatabase) *Node { node := Node{} if consensus != nil { @@ -189,9 +190,14 @@ func New(consensus *consensus.Consensus, db *db.LDBDatabase) *Node { node.blockchain = genesisBlock // Genesis Block (account model) - //gspec = core.Genesis{} - // - //genesis := gspec.MustCommit(ethdb.NewMemDatabase()) + database := hdb.NewMemDatabase() + gspec := core.Genesis{} + + genesis := gspec.MustCommit(database) + fmt.Println(genesis.Root()) + chain, _ := core.NewBlockChain(database, nil, gspec.Config, bft.NewFaker(), vm.Config{}, nil) + node.chain = chain + // UTXO pool from Genesis block node.UtxoPool = blockchain.CreateUTXOPoolFromGenesisBlock(node.blockchain.Blocks[0]) diff --git a/transactions.rlp b/transactions.rlp index e69de29bb..04b73d38f 100755 Binary files a/transactions.rlp and b/transactions.rlp differ