Commit graph

71 commits

Author SHA1 Message Date
Daniel Liu
b3d354a897
all: move main transaction pool into a subpool #27463 (#1890) 2026-01-05 15:43:50 +05:30
Daniel Liu
ec08863ba0
all: use WaigGroup.Go() to simplify code (#1699) 2025-11-29 17:17:08 +05:30
Daniel Liu
173214524f
event: fix Resubscribe deadlock when unsubscribing after inner sub ends #28359 (#1551)
A goroutine is used to manage the lifetime of subscriptions managed by
resubscriptions. When the subscription ends with no error, the resub
goroutine ends as well. However, the resub goroutine needs to live
long enough to read from the unsub channel. Otheriwse, an Unsubscribe
call deadlocks when writing to the unsub channel.

This is fixed by adding a buffer to the unsub channel.

Co-authored-by: Inphi <mlaw2501@gmail.com>
2025-09-24 07:48:23 +08:00
Daniel Liu
53b3431af5
event: initialize maps with known size #27233 (#1550)
Co-authored-by: ucwong <ucwong@126.com>
2025-09-24 07:47:54 +08:00
Daniel Liu
31f5c7da88
all: remove deprecated uses of math.rand #26710 (#1549) 2025-09-22 20:42:14 +08:00
Daniel Liu
03c18e9d47
event: add FeedOf[T] #26310 #26803 (#1547) 2025-09-21 19:41:24 +08:00
Daniel Liu
94992cd1df
event: add ResubscribeErr #22191 (#1546)
This adds a way to get the error of the failing subscription
for logging/debugging purposes.

Co-authored-by: Łukasz Zimnoch <lukaszzimnoch1994@gmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
2025-09-21 19:40:44 +08:00
Daniel Liu
612182f4ab
event: remove redundant conversions #21903 (#1545) 2025-09-21 19:40:16 +08:00
Daniel Liu
219e59dc4f
event: fix inconsistency in Lock and Unlock #20933 #20940 (#1544)
Co-authored-by: Boqin Qin <Bobbqqin@gmail.com>
2025-09-21 19:39:40 +08:00
Daniel Liu
27354ec059
event: fix goroutine leak #20667 (#1543) 2025-09-21 19:39:08 +08:00
Daniel Liu
b0c0e4c1bf
event: add missing timer.Stop call in TestFeed #20868 (#1542)
Co-authored-by: ucwong <ucwong@126.com>
2025-09-21 19:38:34 +08:00
Daniel Liu
fb5cdfc729
event, p2p/simulations/adapters: fix rare goroutine leaks #20657 (#1541)
Co-authored-by: Boqin Qin <bobbqqin@bupt.edu.cn>
Co-authored-by: Felix Lange <fjl@twurst.com>
2025-09-21 19:38:03 +08:00
Daniel Liu
fbecb8c5a5 all: fix staticcheck warning ST1006: don't use generic name self
The name of a method’s receiver should be a reflection of its identity;
often a one or two letter abbreviation of its type suffices (such as
“c” or “cl” for “Client”). Don’t use generic names such as “me”, “this”
or “self”, identifiers typical of object-oriented languages that place
more emphasis on methods as opposed to functions. The name need not be
as descriptive as that of a method argument, as its role is obvious and
serves no documentary purpose. It can be very short as it will appear
on almost every line of every method of the type; familiarity admits
brevity. Be consistent, too: if you call the receiver “c” in one method,
don’t call it “cl” in another.
2024-10-25 21:30:54 +08:00
Daniel Liu
d29ecf427c event: include Feed type fixation logic in f.init (#27249) 2024-08-30 12:42:55 +08:00
Daniel Liu
06d64ff298 event: add missing unlock before panic (#20653) 2024-08-30 12:42:55 +08:00
Daniel Liu
3a51e7573c event: remove unused field closed (#20324) 2024-08-30 12:42:55 +08:00
Felix Lange
c35926c955 event: document select case slice use and add edge case test (#16680)
Feed keeps active subscription channels in a slice called 'f.sendCases'.
The Send method tracks the active cases in a local variable 'cases'
whose value is f.sendCases initially. 'cases' shrinks to a shorter
prefix of f.sendCases every time a send succeeds, moving the successful
case out of range of the active case list.

This can be confusing because the two slices share a backing array. Add
more comments to document what is going on. Also add a test for removing
a case that is in 'f.sentCases' but not 'cases'.
2024-08-30 12:42:55 +08:00
JukLee0ira
2d89951e5b all: use errrors.New instead of empty fmt.Errorf 2024-06-14 19:19:21 +08:00
Daniel Liu
7197172b09 eth/filter: check nil pointer when unsubscribe (#16682)
* eth/filter: check nil pointer when unsubscribe

* eth/filters, accounts, rpc: abort system if subscribe failed

* eth/filter: add crit log before exit

* eth/filter, event: minor fixes
2024-03-18 10:08:25 +08:00
olumuyiwadad
b5abbfed79 new EVM Upgrade
- Solidity Upgraded up to v0.8.0
-  Fixed and Added eth_chainId
- Fix error in TransactionRecipet
- Reward halving issue fixed
2021-09-21 16:53:46 +05:30
olumuyiwadad
571c41f891 FIx Bad block error. 2021-09-17 17:59:06 +05:30
Felix Lange
9313fa63f9 event/filter: delete unused package (#18063) 2018-11-08 14:26:29 +02:00
Corey Lin
968f6019d0 event, event/filter: minor code cleanup (#18061) 2018-11-08 12:17:01 +01:00
Felix Lange
53a18d2e27 event: document select case slice use and add edge case test (#16680)
Feed keeps active subscription channels in a slice called 'f.sendCases'.
The Send method tracks the active cases in a local variable 'cases'
whose value is f.sendCases initially. 'cases' shrinks to a shorter
prefix of f.sendCases every time a send succeeds, moving the successful
case out of range of the active case list.

This can be confusing because the two slices share a backing array. Add
more comments to document what is going on. Also add a test for removing
a case that is in 'f.sentCases' but not 'cases'.
2018-05-10 13:26:36 +03:00
gary rong
4e7dc34ff1 eth/filter: check nil pointer when unsubscribe (#16682)
* eth/filter: check nil pointer when unsubscribe

* eth/filters, accounts, rpc: abort system if subscribe failed

* eth/filter: add crit log before exit

* eth/filter, event: minor fixes
2018-05-09 11:29:25 +03:00
kiel barry
60b433ab84 event: golint updates for this or self warning (#16631)
* event/*: golint updates for this or self warning

* event/*: golint updates for this or self warning, pr updated per feedback
2018-05-03 14:54:36 +03:00
Péter Szilágyi
65738c1eb3
event: fix datarace between Subscribe and Send 2017-10-20 14:42:19 +03:00
Jia Chenhui
cefeb58598 event: fix typo (#15270) 2017-10-10 14:11:15 +02:00
Felix Lange
0cc492f815 all: update license information 2017-04-14 10:29:00 +02:00
Felix Lange
c213fd1fd8 all: import "context" instead of "golang.org/x/net/context"
There is no need to depend on the old context package now that the
minimum Go version is 1.7. The move to "context" eliminates our weird
vendoring setup. Some vendored code still uses golang.org/x/net/context
and it is now vendored in the normal way.

This change triggered new vet checks around context.WithTimeout which
didn't fire with golang.org/x/net/context.
2017-03-22 20:49:15 +01:00
Péter Szilágyi
9b5c7153c9
event: use sync.Once for init for faster/cleaner locking 2017-02-03 14:04:57 +02:00
Felix Lange
1bed9b3fea
event: address review issues (multiple commits)
event: address Feed review issues

event: clarify role of NewSubscription function

event: more Feed review fixes

* take sendLock after dropping f.mu
* add constant for number of special cases

event: fix subscribing/unsubscribing while Send is blocked
2017-02-03 13:37:49 +02:00
Felix Lange
6d5e100d0d event: add new Subscription type and related utilities
This commit introduces a new Subscription type, which is synonymous with
ethereum.Subscription. It also adds a couple of utilities that make
working with Subscriptions easier. The mot complex utility is Feed, a
synchronisation device that implements broadcast subscriptions. Feed is
slightly faster than TypeMux and will replace uses of TypeMux across the
go-ethereum codebase in the future.
2017-01-25 18:44:20 +01:00
Felix Lange
9b62facdd4 event: deprecate TypeMux and related types
The Subscription type is gone, all uses are replaced by
*TypeMuxSubscription. This change is prep-work for the
introduction of the new Subscription type in a later commit.

   gorename -from '"github.com/ethereum/go-ethereum/event"::Event' -to TypeMuxEvent
   gorename -from '"github.com/ethereum/go-ethereum/event"::muxsub' -to TypeMuxSubscription
   gofmt -w -r 'Subscription -> *TypeMuxSubscription' ./event/*.go
   find . -name '*.go' -and -not -regex '\./vendor/.*' \| xargs gofmt -w -r 'event.Subscription -> *event.TypeMuxSubscription'
2017-01-25 16:25:57 +01:00
Felix Lange
35a7dcb162 all: gofmt -w -s 2017-01-06 15:52:03 +01:00
Jeffrey Wilcke
7c1f74713e event: fixed subscribtions to stopped event mux
This fixes an issue where the following would lead to a panic due to a
channel being closed twice:

* Start mux
* Stop mux
* Sub to mux
* Unsub

This is fixed by setting the subscriptions status to closed resulting in
the Unsubscribe to ignore the request when called.
2016-05-12 20:38:09 +02:00
Péter Szilágyi
8e2bf42c46 event/filter: fix data race in the test 2015-11-05 16:55:53 +02:00
Péter Szilágyi
402fd6e8c6 core, eth, event, miner, xeth: fix event post / subscription race 2015-10-12 16:22:03 +03:00
Jeffrey Wilcke
f7a71996fb core, event/filter, xeth: refactored filter system
Moved the filtering system from `event` to `eth/filters` package and
removed the `core.Filter` object. The `filters.Filter` object now
requires a `common.Database` rather than a `eth.Backend` and invokes the
`core.GetBlockByX` directly rather than thru a "manager".
2015-10-02 22:47:43 +02:00
Felix Lange
bfbcfbe4a9 all: fix license headers one more time
I forgot to update one instance of "go-ethereum" in commit 3f047be5a.
2015-07-23 18:35:11 +02:00
Felix Lange
3f047be5aa all: update license headers to distiguish GPL/LGPL
All code outside of cmd/ is licensed as LGPL. The headers
now reflect this by calling the whole work "the go-ethereum library".
2015-07-22 18:51:45 +02:00
Felix Lange
bdae4fd573 all: add some godoc synopsis comments 2015-07-07 14:12:45 +02:00
Felix Lange
ea54283b30 all: update license information 2015-07-07 14:12:44 +02:00
Péter Szilágyi
4541c22964 event/filter: hack around data race in the test 2015-06-09 21:33:39 +03:00
obscuren
7e160a677d xeth, core, event/filter, rpc: new block and transaction filters 2015-05-07 14:44:32 +02:00
obscuren
09147a50ed Improved tx pool to ignore invalid transactions
Transaction pool will attempt to ignore invalid transactions it had
previously encountered.
2015-04-08 00:31:23 +02:00
obscuren
0330077d76 moved state and vm to core 2015-03-23 16:59:09 +01:00
Taylor Gerring
28e1971272 Merge branch 'rpcxeth' into rpcfrontier
Conflicts:
	rpc/api.go
2015-03-20 15:25:43 +01:00
obscuren
55fdf3e462 Listen to tx pre event and trigger 'pending' 2015-03-20 12:07:06 +01:00
Taylor Gerring
6c04c19eb4 Reorg filter logic to XEth 2015-03-19 22:58:07 -04:00