tendermint/common
Anton Kaliaev 8a51210efc
[common] use temp intead of {filePath}.new
The problem with {filePath}.new is that it is not safe for concurrent
use! Calling this function with the same params results in the following
error:

```
panic: Panicked on a Crisis: rename /root/.tendermint_test/consensus_replay_test/priv_validator.json.new /root/.tendermint_test/consensus_replay_test/priv_validator.json: no such file or directory

goroutine 47860 [running]:
github.com/tendermint/tendermint/vendor/github.com/tendermint/tmlibs/common.PanicCrisis(0xcba800, 0xc42152d640)
	/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/tmlibs/common/errors.go:33 +0x10f
github.com/tendermint/tendermint/types.(*PrivValidator).save(0xc42235f2c0)
	/go/src/github.com/tendermint/tendermint/types/priv_validator.go:165 +0x159
github.com/tendermint/tendermint/types.(*PrivValidator).signBytesHRS(0xc42235f2c0, 0x6, 0x0, 0xc424e88f03, 0xc429908580, 0xca, 0x155, 0x80, 0xc424e88f00, 0x7f4ecafc88d0, ...)
	/go/src/github.com/tendermint/tendermint/types/priv_validator.go:249 +0x2bb
github.com/tendermint/tendermint/types.(*PrivValidator).SignVote(0xc42235f2c0, 0xc4228c7460, 0xf, 0xc424e88f00, 0x0, 0x0)
	/go/src/github.com/tendermint/tendermint/types/priv_validator.go:186 +0x1a2
github.com/tendermint/tendermint/consensus.(*ConsensusState).signVote(0xc424efd520, 0xc400000002, 0xc422d5e3c0, 0x14, 0x20, 0x1, 0xc4247b6560, 0x14, 0x20, 0x0, ...)
	github.com/tendermint/tendermint/consensus/_test/_obj_test/state.go:1556 +0x35e
github.com/tendermint/tendermint/consensus.(*ConsensusState).signAddVote(0xc424efd520, 0x2, 0xc422d5e3c0, 0x14, 0x20, 0x1, 0xc4247b6560, 0x14, 0x20, 0xc42001b300)
	github.com/tendermint/tendermint/consensus/_test/_obj_test/state.go:1568 +0x200
github.com/tendermint/tendermint/consensus.(*ConsensusState).enterPrecommit(0xc424efd520, 0x6, 0x0)
	github.com/tendermint/tendermint/consensus/_test/_obj_test/state.go:1082 +0x13a4
github.com/tendermint/tendermint/consensus.(*ConsensusState).addVote(0xc424efd520, 0xc424e88780, 0x0, 0x0, 0x39, 0x1dc, 0x28c)
	github.com/tendermint/tendermint/consensus/_test/_obj_test/state.go:1477 +0x1be5
github.com/tendermint/tendermint/consensus.(*ConsensusState).tryAddVote(0xc424efd520, 0xc424e88780, 0x0, 0x0, 0xd7fb00, 0xc42152ce00)
	github.com/tendermint/tendermint/consensus/_test/_obj_test/state.go:1382 +0x93
github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg(0xc424efd520, 0xcb58e0, 0xc42547feb8, 0x0, 0x0, 0x6, 0x0, 0x4, 0xed10ca07e, 0x3077bfea, ...)
	github.com/tendermint/tendermint/consensus/_test/_obj_test/state.go:660 +0x9fc
github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine(0xc424efd520, 0x0)
	github.com/tendermint/tendermint/consensus/_test/_obj_test/state.go:615 +0x5f5
created by github.com/tendermint/tendermint/consensus.(*ConsensusState).OnStart
	github.com/tendermint/tendermint/consensus/_test/_obj_test/state.go:332 +0x4a7
exit status 2
FAIL	github.com/tendermint/tendermint/consensus	76.644s
make: *** [test_integrations] Error 1
```

See https://github.com/tendermint/tendermint/pull/568
2017-07-28 11:39:59 -04:00
..
LICENSE move all files to common/ to begin repo merge 2017-04-18 16:33:22 -04:00
array.go move all files to common/ to begin repo merge 2017-04-18 16:33:22 -04:00
async.go move all files to common/ to begin repo merge 2017-04-18 16:33:22 -04:00
bit_array.go move all files to common/ to begin repo merge 2017-04-18 16:33:22 -04:00
bit_array_test.go move all files to common/ to begin repo merge 2017-04-18 16:33:22 -04:00
byteslice.go move all files to common/ to begin repo merge 2017-04-18 16:33:22 -04:00
cmap.go move all files to common/ to begin repo merge 2017-04-18 16:33:22 -04:00
colors.go move all files to common/ to begin repo merge 2017-04-18 16:33:22 -04:00
date.go changelog and PR changes 2017-06-20 17:18:55 -04:00
date_test.go changelog and PR changes 2017-06-20 17:18:55 -04:00
errors.go move all files to common/ to begin repo merge 2017-04-18 16:33:22 -04:00
heap.go move all files to common/ to begin repo merge 2017-04-18 16:33:22 -04:00
int.go move all files to common/ to begin repo merge 2017-04-18 16:33:22 -04:00
io.go move all files to common/ to begin repo merge 2017-04-18 16:33:22 -04:00
math.go move all files to common/ to begin repo merge 2017-04-18 16:33:22 -04:00
net.go common: ProtocolAndAddress 2017-07-19 15:02:04 -04:00
net_test.go common: ProtocolAndAddress 2017-07-19 15:02:04 -04:00
os.go [common] use temp intead of {filePath}.new 2017-07-28 11:39:59 -04:00
random.go move all files to common/ to begin repo merge 2017-04-18 16:33:22 -04:00
repeat_timer.go move all files to common/ to begin repo merge 2017-04-18 16:33:22 -04:00
service.go Logger interface and tmLogger impl based on go-kit 2017-05-05 21:43:07 +04:00
service_test.go move all files to common/ to begin repo merge 2017-04-18 16:33:22 -04:00
string.go golint corrections 2017-06-05 16:22:01 -04:00
throttle_timer.go move all files to common/ to begin repo merge 2017-04-18 16:33:22 -04:00
word.go move all files to common/ to begin repo merge 2017-04-18 16:33:22 -04:00