aboutsummaryrefslogtreecommitdiffstats
path: root/core/test/state.go
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2019-01-04 18:54:56 +0800
committerGitHub <noreply@github.com>2019-01-04 18:54:56 +0800
commitc7fdbd64be6228aa87b14f8953311c88cc14b4ff (patch)
tree92ea7f247184f57dc86ba355f97f1301af24fc7f /core/test/state.go
parent8bbf4bc3face4e040e52afd392b70def7b3aaf58 (diff)
downloaddexon-consensus-c7fdbd64be6228aa87b14f8953311c88cc14b4ff.tar
dexon-consensus-c7fdbd64be6228aa87b14f8953311c88cc14b4ff.tar.gz
dexon-consensus-c7fdbd64be6228aa87b14f8953311c88cc14b4ff.tar.bz2
dexon-consensus-c7fdbd64be6228aa87b14f8953311c88cc14b4ff.tar.lz
dexon-consensus-c7fdbd64be6228aa87b14f8953311c88cc14b4ff.tar.xz
dexon-consensus-c7fdbd64be6228aa87b14f8953311c88cc14b4ff.tar.zst
dexon-consensus-c7fdbd64be6228aa87b14f8953311c88cc14b4ff.zip
test: allow empty change request (#398)
* allow empty reqs * Fix license
Diffstat (limited to 'core/test/state.go')
-rw-r--r--core/test/state.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/core/test/state.go b/core/test/state.go
index a1af47c..e943a8a 100644
--- a/core/test/state.go
+++ b/core/test/state.go
@@ -532,6 +532,9 @@ func (req reqByTime) Less(i, j int) bool {
// Apply change requests, this function would also
// be called when we extract these request from delivered blocks.
func (s *State) Apply(reqsAsBytes []byte) (err error) {
+ if len(reqsAsBytes) == 0 {
+ return
+ }
// Try to unmarshal this byte stream into []*StateChangeRequest.
reqs, err := s.unpackRequests(reqsAsBytes)
if err != nil {