diff --git a/api/service/discovery/service.go b/api/service/discovery/service.go index 097b9452e..3e07c696c 100644 --- a/api/service/discovery/service.go +++ b/api/service/discovery/service.go @@ -129,7 +129,7 @@ func (s *Service) contactP2pPeers() { } } if err != nil { - utils.GetLogInstance().Error("Failed to send ping message", "group", g) + utils.GetLogInstance().Error("[DISCOVERY] Failed to send ping message", "group", g) } else { utils.GetLogInstance().Info("[DISCOVERY]", "Sent Ping Message", g) } diff --git a/api/service/staking/service.go b/api/service/staking/service.go index 7d2fc644a..610f1c9e3 100644 --- a/api/service/staking/service.go +++ b/api/service/staking/service.go @@ -6,6 +6,8 @@ import ( "math/big" "time" + "github.com/ethereum/go-ethereum/rlp" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/log" @@ -143,19 +145,22 @@ func (s *Service) getFakeStakingInfo() *proto.StakingContractInfoResponse { // Constructs the staking message func constructStakingMessage(ts types.Transactions) []byte { - msg := &message.Message{ - Type: message.MessageType_NEWNODE_BEACON_STAKING, - Request: &message.Message_Staking{ - Staking: &message.StakingRequest{ - Transaction: ts.GetRlp(0), - NodeId: "", + tsBytes, err := rlp.EncodeToBytes(ts) + if err == nil { + msg := &message.Message{ + Type: message.MessageType_NEWNODE_BEACON_STAKING, + Request: &message.Message_Staking{ + Staking: &message.StakingRequest{ + Transaction: tsBytes, + NodeId: "", + }, }, - }, - } - if data, err := protobuf.Marshal(msg); err == nil { - return data + } + if data, err := protobuf.Marshal(msg); err == nil { + return data + } } - utils.GetLogInstance().Error("Error when creating staking message") + utils.GetLogInstance().Error("Error when creating staking message", "error", err) return nil } diff --git a/node/node.go b/node/node.go index 1140e654f..967dacdaf 100644 --- a/node/node.go +++ b/node/node.go @@ -260,7 +260,7 @@ func New(host p2p.Host, consensusObj *consensus.Consensus, db ethdb.Database) *N if node.Role == BeaconLeader || node.Role == BeaconValidator { node.CurrentStakes = make(map[common.Address]int64) } - utils.GetLogInstance().Debug("Received", "blockHash", chain.GetBlockByNumber(0).Hash().Hex()) + utils.GetLogInstance().Debug("Created Genesis Block", "blockHash", chain.GetBlockByNumber(0).Hash().Hex()) node.Consensus.ConsensusBlock = make(chan *consensus.BFTBlockInfo) node.Consensus.VerifiedNewBlock = make(chan *types.Block) } diff --git a/node/node_handler.go b/node/node_handler.go index 57878e29e..5cad6c183 100644 --- a/node/node_handler.go +++ b/node/node_handler.go @@ -207,7 +207,8 @@ func (node *Node) addStakingTxnIntoPendingTxns(msgPayload []byte) { if err == nil { stakingRequest := msg.GetStaking() txs := types.Transactions{} - if err = rlp.DecodeBytes(stakingRequest.Transaction, txs); err == nil { + if err = rlp.DecodeBytes(stakingRequest.Transaction, &txs); err == nil { + utils.GetLogInstance().Error("Successfully added staking transaction to pending list.") node.addPendingTransactions(txs) } else { utils.GetLogInstance().Error("Failed to unmarshal staking transaction list", "error", err) @@ -357,6 +358,7 @@ func (node *Node) pingMessageHandler(msgPayload []byte, sender string) int { } // Add to Node's peer list anyway + utils.GetLogInstance().Info("Add Peer to Node", "Node", node.Consensus.GetNodeID(), "Pear", peer) node.AddPeers([]*p2p.Peer{peer}) return 1 diff --git a/node/node_newblock.go b/node/node_newblock.go index 0be21d6bb..7bf6fb3ee 100644 --- a/node/node_newblock.go +++ b/node/node_newblock.go @@ -47,7 +47,7 @@ func (node *Node) WaitForConsensusReady(readySignal chan struct{}, stopChan chan threshold = FirstTimeThreshold firstTime = false } - utils.GetLogInstance().Debug("STARTING BLOCK", "threshold", threshold, "pendingTransactions", len(node.pendingTransactions)) + utils.GetLogInstance().Debug("Proposing New Block...", "threshold", threshold, "pendingTransactions", len(node.pendingTransactions)) if len(node.pendingTransactions) >= threshold { // Normal tx block consensus selectedTxs := node.getTransactionsForNewBlock(MaxNumberOfTransactionsPerBlock)