diff --git a/node/message.go b/node/message.go index c02841d81..fa1278e5d 100644 --- a/node/message.go +++ b/node/message.go @@ -15,7 +15,6 @@ const ( BLOCK CONTROL - EXPERIMENT // Exist only for experiment setup // TODO: add more types ) @@ -42,14 +41,6 @@ const ( STOP ControlMessageType = iota ) -// The types of messages used for NODE/EXPERIMENT -type ExperimentMessageType int - -const ( - UTXO_REQUEST ExperimentMessageType = iota - UTXO_RESPONSE -) - // Constructs serialized transactions func ConstructTransactionListMessage(transactions []*blockchain.Transaction) []byte { byteBuffer := bytes.NewBuffer([]byte{byte(common.NODE)}) @@ -84,17 +75,6 @@ func ConstructStopMessage() []byte { return byteBuffer.Bytes() } -// Constructs utxo response message with serialized utxoPool to return -func ConstructUtxoResponseMessage(pool blockchain.UTXOPool) []byte { - byteBuffer := bytes.NewBuffer([]byte{byte(common.NODE)}) - byteBuffer.WriteByte(byte(EXPERIMENT)) - byteBuffer.WriteByte(byte(UTXO_RESPONSE)) - encoder := gob.NewEncoder(byteBuffer) - - encoder.Encode(pool) - return byteBuffer.Bytes() -} - // Constructs blocks sync message to send blocks to other nodes func ConstructBlocksSyncMessage(blocks []blockchain.Block) []byte { byteBuffer := bytes.NewBuffer([]byte{byte(common.NODE)}) diff --git a/node/node_handler.go b/node/node_handler.go index a4eaaac72..3193b086d 100644 --- a/node/node_handler.go +++ b/node/node_handler.go @@ -101,21 +101,6 @@ func (node *Node) NodeHandler(conn net.Conn) { os.Exit(0) } - case EXPERIMENT: - expType := msgPayload[0] - switch ExperimentMessageType(expType) { - case UTXO_REQUEST: - node.log.Debug("Received UTXO request") - p2p.SendMessage(*node.ClientPeer, ConstructUtxoResponseMessage(node.UtxoPool.GetSnapshot())) - case UTXO_RESPONSE: - node.log.Debug("Received UTXO response") - decoder := gob.NewDecoder(bytes.NewReader(msgPayload[1:])) // skip the UTXO_RESPONSE messge type - utxoPool := new(blockchain.UTXOPool) - decoder.Decode(utxoPool) - if node.Client != nil && utxoPool != nil { - //node.Client.UpdateUtxoPool(*utxoPool) - } - } } case common.CLIENT: actionType := client.ClientMessageType(msgType)