erigon-pulse/txpool
Andrew Ashikhmin 10e842853b
txpool: sync.Mutex instead of RWMutex (#735)
[simplelru](https://github.com/hashicorp/golang-lru/tree/master/simplelru)
is not thread safe. During the `Get` operation, the recentness of the
accessed item is updated, so it is not a pure read-operation. Therefore,
the mutex we need to protect the LRUs in txpool is a full mutex, not
`RLock`. See
https://github.com/ledgerwatch/erigon/issues/4679#issuecomment-1312064790
and https://github.com/ethereum/go-ethereum/pull/26164.

Also, RWMutex has a performance overhead compared with the vanilla one
(see, for example, https://github.com/golang/go/issues/38813).

Kudos to Martin Swende for pointing to the issue.
2022-11-14 11:59:02 +01:00
..
testdata ErigonLib: move types to own package (#413) 2022-04-11 10:02:44 +07:00
txpooluitl WithTablessCfg -> WithTableCfg (#601) 2022-08-24 11:02:47 +02:00
fetch_test.go Update interfaces (#733) 2022-11-11 16:36:22 +01:00
fetch.go Fieldalign (#695) 2022-10-21 15:31:23 +07:00
mocks_test.go Update interfaces (#733) 2022-11-11 16:36:22 +01:00
pool_fuzz_test.go Update interfaces (#733) 2022-11-11 16:36:22 +01:00
pool_test.go Update interfaces (#733) 2022-11-11 16:36:22 +01:00
pool.go txpool: sync.Mutex instead of RWMutex (#735) 2022-11-14 11:59:02 +01:00
send.go Fieldalign (#695) 2022-10-21 15:31:23 +07:00
test_util.go Fieldalign (#695) 2022-10-21 15:31:23 +07:00
txpool_grpc_server.go [txpool] Best function to accept onTopOf argument and indicate whenever it is too early to gather tx for a block (#685) 2022-10-14 23:11:37 +01:00