From 898f44ddda29ab1c3d19462a87ea79e1caac3cc9 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Thu, 10 Mar 2016 15:50:35 -0500 Subject: [PATCH] config: disable_data_hash (for testing) --- config/tendermint/config.go | 1 + config/tendermint_test/config.go | 1 + types/block.go | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/config/tendermint/config.go b/config/tendermint/config.go index 6378607fe..74d7aefeb 100644 --- a/config/tendermint/config.go +++ b/config/tendermint/config.go @@ -70,6 +70,7 @@ func GetConfig(rootDir string) cfg.Config { mapConfig.SetDefault("cswal_light", false) mapConfig.SetDefault("block_size", 10000) + mapConfig.SetDefault("disable_data_hash", false) mapConfig.SetDefault("timeout_propose", 3000) mapConfig.SetDefault("timeout_propose_delta", 500) mapConfig.SetDefault("timeout_prevote", 1000) diff --git a/config/tendermint_test/config.go b/config/tendermint_test/config.go index b90fe2549..c2690ae90 100644 --- a/config/tendermint_test/config.go +++ b/config/tendermint_test/config.go @@ -88,6 +88,7 @@ func GetConfig(rootDir string) cfg.Config { mapConfig.SetDefault("cswal_light", false) mapConfig.SetDefault("block_size", 10000) + mapConfig.SetDefault("disable_data_hash", false) mapConfig.SetDefault("timeout_propose", 100) mapConfig.SetDefault("timeout_propose_delta", 1) mapConfig.SetDefault("timeout_prevote", 1) diff --git a/types/block.go b/types/block.go index 1e197c621..f2d1ef578 100644 --- a/types/block.go +++ b/types/block.go @@ -336,6 +336,10 @@ type Data struct { } func (data *Data) Hash() []byte { + if config.GetBool("disable_data_hash") { + data.hash = []byte{} + return data.hash + } if data.hash == nil { txs := make([]interface{}, len(data.Txs)) for i, tx := range data.Txs {