From 0e7e2c9ab3f164e25b040c7ca16b73cbc1c135e8 Mon Sep 17 00:00:00 2001 From: astaphobia Date: Wed, 2 Oct 2019 17:45:52 +0800 Subject: [PATCH 1/2] this commit to change NodeAddress as message NodeAddress --- documentation.swagger.json | 34 ++++++++++++++++++++++++++-------- model/nodeRegistration.proto | 8 ++++++-- model/transaction.proto | 7 +++++-- service/p2pCommunication.proto | 1 - 4 files changed, 37 insertions(+), 13 deletions(-) diff --git a/documentation.swagger.json b/documentation.swagger.json index 682fce9..7c1e657 100644 --- a/documentation.swagger.json +++ b/documentation.swagger.json @@ -332,7 +332,13 @@ }, { "type": "string", - "name": "NodeAddress", + "name": "NodeAddress.Address", + "in": "query" + }, + { + "type": "integer", + "format": "int64", + "name": "NodeAddress.Port", "in": "query" } ], @@ -1189,6 +1195,18 @@ } } }, + "modelNodeAddress": { + "type": "object", + "properties": { + "Address": { + "type": "string" + }, + "Port": { + "type": "integer", + "format": "int64" + } + } + }, "modelNodeHardware": { "type": "object", "properties": { @@ -1228,7 +1246,7 @@ "format": "int64" }, "NodeAddress": { - "type": "string" + "$ref": "#/definitions/modelNodeAddress" }, "NodeID": { "type": "string", @@ -1256,11 +1274,11 @@ }, "LockedBalance": { "type": "string", - "format": "int64", - "title": "Funds to be locked to register the node" + "format": "int64" }, "NodeAddress": { - "type": "string" + "title": "string NodeAddress = 3;\nFunds to be locked to register the node", + "$ref": "#/definitions/modelNodeAddress" }, "NodePublicKey": { "type": "string", @@ -1557,11 +1575,11 @@ "properties": { "LockedBalance": { "type": "string", - "format": "int64", - "title": "Funds to be locked to register the node" + "format": "int64" }, "NodeAddress": { - "type": "string" + "title": "string NodeAddress = 2;\nFunds to be locked to register the node", + "$ref": "#/definitions/modelNodeAddress" }, "NodePublicKey": { "type": "string", diff --git a/model/nodeRegistration.proto b/model/nodeRegistration.proto index 5143933..be48a26 100644 --- a/model/nodeRegistration.proto +++ b/model/nodeRegistration.proto @@ -5,12 +5,16 @@ option go_package = "github.com/zoobc/zoobc-core/common/model"; import "model/pagination.proto"; +message NodeAddress { + string Address = 1; + uint32 Port = 2; +} message NodeRegistration { int64 NodeID = 1 [jstype = JS_STRING]; bytes NodePublicKey = 2; string AccountAddress = 3; uint32 RegistrationHeight = 4; - string NodeAddress = 5; + NodeAddress NodeAddress = 5; int64 LockedBalance = 6 [jstype = JS_STRING]; bool Queued = 7; bool Latest = 8; @@ -43,7 +47,7 @@ message GetNodeRegistrationRequest { bytes NodePublicKey = 1; string AccountAddress = 2; uint32 RegistrationHeight = 3; - string NodeAddress = 4; + NodeAddress NodeAddress = 4; } message GetNodeRegistrationResponse { diff --git a/model/transaction.proto b/model/transaction.proto index 32186ab..e267810 100644 --- a/model/transaction.proto +++ b/model/transaction.proto @@ -6,6 +6,7 @@ option go_package = "github.com/zoobc/zoobc-core/common/model"; import "model/proofOfOwnership.proto"; import "model/pagination.proto"; import "model/batchReceipt.proto"; +import "model/nodeRegistration.proto"; // Transaction represent the transaction data structure stored in the database @@ -65,8 +66,9 @@ message SendMoneyTransactionBody { message NodeRegistrationTransactionBody { bytes NodePublicKey = 1; string AccountAddress = 2; - string NodeAddress = 3; +// string NodeAddress = 3; // Funds to be locked to register the node + NodeAddress NodeAddress = 3; int64 LockedBalance = 4 [jstype = JS_STRING]; // Proof of ownership (message + signature) ProofOfOwnership Poown = 5; @@ -74,8 +76,9 @@ message NodeRegistrationTransactionBody { message UpdateNodeRegistrationTransactionBody { bytes NodePublicKey = 1; - string NodeAddress = 2; +// string NodeAddress = 2; // Funds to be locked to register the node + NodeAddress NodeAddress = 2; int64 LockedBalance = 3 [jstype = JS_STRING]; // Proof of ownership (message + signature) ProofOfOwnership Poown = 4; diff --git a/service/p2pCommunication.proto b/service/p2pCommunication.proto index 371b7b9..476e82d 100644 --- a/service/p2pCommunication.proto +++ b/service/p2pCommunication.proto @@ -10,7 +10,6 @@ import "model/empty.proto"; import "model/block.proto"; import "model/blockchain.proto"; import "model/transaction.proto"; -import "model/batchReceipt.proto"; service P2PCommunication { rpc GetPeerInfo(model.GetPeerInfoRequest) returns (model.Node) {} From c29e9fe005ca33e24ec5b8f961a3a104bbd94fdf Mon Sep 17 00:00:00 2001 From: astaphobia Date: Thu, 3 Oct 2019 08:18:59 +0800 Subject: [PATCH 2/2] this commit remove commented codes --- model/transaction.proto | 2 -- 1 file changed, 2 deletions(-) diff --git a/model/transaction.proto b/model/transaction.proto index e267810..6d7e3f6 100644 --- a/model/transaction.proto +++ b/model/transaction.proto @@ -66,7 +66,6 @@ message SendMoneyTransactionBody { message NodeRegistrationTransactionBody { bytes NodePublicKey = 1; string AccountAddress = 2; -// string NodeAddress = 3; // Funds to be locked to register the node NodeAddress NodeAddress = 3; int64 LockedBalance = 4 [jstype = JS_STRING]; @@ -76,7 +75,6 @@ message NodeRegistrationTransactionBody { message UpdateNodeRegistrationTransactionBody { bytes NodePublicKey = 1; -// string NodeAddress = 2; // Funds to be locked to register the node NodeAddress NodeAddress = 2; int64 LockedBalance = 3 [jstype = JS_STRING];