aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--core/test/state.go3
-rw-r--r--core/utils/utils.go16
2 files changed, 3 insertions, 16 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 {
diff --git a/core/utils/utils.go b/core/utils/utils.go
index 687d0ea..8c9f77a 100644
--- a/core/utils/utils.go
+++ b/core/utils/utils.go
@@ -15,22 +15,6 @@
// along with the dexon-consensus library. If not, see
// <http://www.gnu.org/licenses/>.
-// This file is part of the dexon-consensus library.
-//
-// The dexon-consensus library is free software: you can redistribute it
-// and/or modify it under the terms of the GNU Lesser General Public License as
-// published by the Free Software Foundation, either version 3 of the License,
-// or (at your option) any later version.
-//
-// The dexon-consensus library is distributed in the hope that it will be
-// useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
-// General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with the dexon-consensus library. If not, see
-// <http://www.gnu.org/licenses/>.
-
package utils
import (