aboutsummaryrefslogtreecommitdiffstats
path: root/core/test/marshaller.go
diff options
context:
space:
mode:
authorMission Liao <mission.liao@dexon.org>2018-11-09 22:15:28 +0800
committerGitHub <noreply@github.com>2018-11-09 22:15:28 +0800
commit81372e5746fedf0ad691ab628096b7caefbe3008 (patch)
tree1b705364be7ecda7c322230deb441820b8858613 /core/test/marshaller.go
parenta7e3c046693d9df860422e71a14c8659b36afe6a (diff)
downloaddexon-consensus-81372e5746fedf0ad691ab628096b7caefbe3008.tar
dexon-consensus-81372e5746fedf0ad691ab628096b7caefbe3008.tar.gz
dexon-consensus-81372e5746fedf0ad691ab628096b7caefbe3008.tar.bz2
dexon-consensus-81372e5746fedf0ad691ab628096b7caefbe3008.tar.lz
dexon-consensus-81372e5746fedf0ad691ab628096b7caefbe3008.tar.xz
dexon-consensus-81372e5746fedf0ad691ab628096b7caefbe3008.tar.zst
dexon-consensus-81372e5746fedf0ad691ab628096b7caefbe3008.zip
test: implement pulling in network layer (#314)
* Add definition for test.PullRequest * Cache notary sets for each round in network module * Cache peers as nodeID in network module. * Implement pull blocks * Implement pull vote
Diffstat (limited to 'core/test/marshaller.go')
-rw-r--r--core/test/marshaller.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/core/test/marshaller.go b/core/test/marshaller.go
index a1b15b6..5f15e11 100644
--- a/core/test/marshaller.go
+++ b/core/test/marshaller.go
@@ -101,6 +101,12 @@ func (m *DefaultMarshaller) Unmarshal(
break
}
msg = *packed
+ case "pull-request":
+ req := &PullRequest{}
+ if err = json.Unmarshal(payload, req); err != nil {
+ break
+ }
+ msg = req
default:
if m.fallback == nil {
err = fmt.Errorf("unknown msg type: %v", msgType)
@@ -145,6 +151,9 @@ func (m *DefaultMarshaller) Marshal(
case packedStateChanges:
msgType = "packed-state-changes"
payload, err = json.Marshal(msg)
+ case *PullRequest:
+ msgType = "pull-request"
+ payload, err = json.Marshal(msg)
default:
if m.fallback == nil {
err = fmt.Errorf("unknwon message type: %v", msg)