neo-go/pkg/core
Roman Khimov 0cd3493fa5 core: fix potential locking problem in mempool
I think it should fix this issue mentioned in the #526:

INFO[1456] blockchain persist completed                  blockHeight=63480 headerHeight=1810000 persistedBlocks=1 persistedKeys=4 took=740.7113ms
fatal error: concurrent map read and map write

goroutine 322 [running]:
runtime.throw(0xc8a6dc, 0x21)
        /usr/local/go/src/runtime/panic.go:774 +0x72 fp=0xc003473958 sp=0xc003473928 pc=0x42e282
runtime.mapaccess2(0xb706a0, 0xc0001893b0, 0xc0034739c8, 0xc0028704e0, 0x3)
        /usr/local/go/src/runtime/map.go:470 +0x278 fp=0xc0034739a0 sp=0xc003473958 pc=0x40dc08
github.com/CityOfZion/neo-go/pkg/core.MemPool.ContainsKey(0xc0001d0d20, 0xc0001893b0, 0xc0001893e0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /neo-go/pkg/core/mem_pool.go:92 +0xcb fp=0xc003473a30 sp=0xc0034739a0 pc=0x9326db
github.com/CityOfZion/neo-go/pkg/core.(*Blockchain).HasTransaction(0xc0001ca8c0, 0x49f0b45d430e441b, 0x553db79b7072821c, 0x28969518de11976, 0xba5100efddbe79d4, 0xc003473cd0)
        /neo-go/pkg/core/blockchain.go:803 +0xa1 fp=0xc003473b68 sp=0xc003473a30 pc=0x914b11
github.com/CityOfZion/neo-go/pkg/core.Blockchainer.HasTransaction-fm(0x49f0b45d430e441b, 0x553db79b7072821c, 0x28969518de11976, 0xba5100efddbe79d4, 0xc005a5d388)
        /neo-go/pkg/core/blockchainer.go:28 +0x46 fp=0xc003473ba8 sp=0xc003473b68 pc=0x997326
github.com/CityOfZion/neo-go/pkg/network.(*Server).handleInvCmd(0xc00018f680, 0xd9d980, 0xc00025e190, 0xc005a5d380, 0x0, 0x0)
        /neo-go/pkg/network/server.go:401 +0x3bb fp=0xc003473d38 sp=0xc003473ba8 pc=0x9924cb
github.com/CityOfZion/neo-go/pkg/network.(*Server).handleMessage(0xc00018f680, 0xd9d980, 0xc00025e190, 0xc007a0d050, 0x0, 0x0)
        /neo-go/pkg/network/server.go:582 +0x1ae fp=0xc003473da0 sp=0xc003473d38 pc=0x993bbe
github.com/CityOfZion/neo-go/pkg/network.(*TCPTransport).handleConn(0xc000228420, 0xd9b880, 0xc0001b6f00)
        /neo-go/pkg/network/tcp_transport.go:93 +0x202 fp=0xc003473fc8 sp=0xc003473da0 pc=0x996672
runtime.goexit()
        /usr/local/go/src/runtime/asm_amd64.s:1357 +0x1 fp=0xc003473fd0 sp=0xc003473fc8 pc=0x45b3e1
created by github.com/CityOfZion/neo-go/pkg/network.(*TCPTransport).Dial
        /neo-go/pkg/network/tcp_transport.go:36 +0xb4

The problem is that we're modifying `unsortedTxn` under a reader lock.
2019-12-02 22:36:59 +03:00
..
storage core: change notify implementation to save notifications 2019-11-15 18:04:59 +03:00
test_data Persist blockchain with leveldb on disk (#48) 2018-03-17 12:53:21 +01:00
transaction transaction: don't hide decoding error by logging 2019-11-27 13:12:04 +03:00
account_state.go rpc: remove duplicating definition of UTXO 2019-11-19 17:35:04 +03:00
account_state_test.go core: rework balance accounting 2019-11-15 22:05:09 +03:00
asset_state.go core: deduplicate state commit methods, use interim MemCachedStore 2019-10-16 17:33:45 +03:00
asset_state_test.go core: add putAssetStateIntoStore() 2019-10-15 12:56:25 +03:00
block.go util: implement io.Serializable for Uint256 2019-11-14 14:20:38 +03:00
block_base.go network: plug in dBFT library 2019-11-27 10:57:22 +03:00
block_test.go codestyle: declare empty slice 2019-10-18 18:38:33 +03:00
blockchain.go core: fix blockchain init with (2000*N + 1) header hashes in DB 2019-11-29 16:26:44 +03:00
blockchain_state.go core: restore intermediate block-level store 2019-11-27 13:28:13 +03:00
blockchain_state_test.go core: unit tests blockchain state 2019-11-21 15:41:49 +03:00
blockchain_test.go core: add Close() to blockchainer, implement it to properly close chain 2019-11-08 12:19:54 +03:00
blockchainer.go *: gofmt 2019-12-02 10:10:50 +03:00
coin_state.go Persist transactions (#51) 2018-03-21 17:11:04 +01:00
contract_state.go sc: implement io.Serializable for ParamType 2019-11-14 14:20:38 +03:00
contract_state_test.go *: fix some misspellings 2019-10-17 12:30:24 +03:00
feer.go Implement rpc server method: sendrawtransaction (#174) 2019-03-20 12:30:05 +00:00
header.go fix spelling and godoc comments 2019-10-22 17:56:03 +03:00
header_hash_list.go util: implement io.Serializable for Uint256 2019-11-14 14:20:38 +03:00
header_test.go io: redo Serializable to return errors in BinReader/BinWriter 2019-09-17 13:21:52 +03:00
helper_test.go network: plug in dBFT library 2019-11-27 10:57:22 +03:00
interop_neo.go core/crypto: add validators and interop for validators 2019-11-21 15:23:35 +03:00
interop_neo_test.go core: add unit tests for interops_neo 2019-11-18 19:31:27 +03:00
interop_system.go core: add contract hash into the error output for checkStorageContext() 2019-11-15 18:04:59 +03:00
interops.go core/crypto: add validators and interop for validators 2019-11-21 15:23:35 +03:00
mem_pool.go core: fix potential locking problem in mempool 2019-12-02 22:36:59 +03:00
mem_pool_test.go core: remove transactions from MemPool when they're stored in block 2019-10-24 13:12:02 +03:00
notification_event.go core: implement EncodeBinary on value 2019-11-15 22:05:09 +03:00
prometheus.go monitoring: add prometheus monitoring 2019-10-29 20:51:17 +03:00
random_util_test.go pkg: make use of the new crypto/hash package 2019-08-26 13:32:19 +03:00
spent_coin_state.go core: deduplicate state commit methods, use interim MemCachedStore 2019-10-16 17:33:45 +03:00
spent_coin_state_test.go core: deduplicate state commit methods, use interim MemCachedStore 2019-10-16 17:33:45 +03:00
storage_item.go core: implement StorageItem for future interops 2019-10-15 12:56:25 +03:00
storage_item_test.go core: implement StorageItem for future interops 2019-10-15 12:56:25 +03:00
unspent_coin_state.go unspentcoinstate: fix branch never executed 2019-10-21 12:40:11 +03:00
unspent_coint_state_test.go core: deduplicate state commit methods, use interim MemCachedStore 2019-10-16 17:33:45 +03:00
util.go core: create blockchain state that represents state of the bc 2019-11-21 15:41:49 +03:00
util_test.go uint256: add Reverse(), change String() to be BE 2019-08-26 13:32:19 +03:00
validator_state.go core: add weighted function for validators 2019-11-21 15:41:49 +03:00
validator_state_test.go core: unit test validator state 2019-11-21 15:41:49 +03:00