mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 10:50:44 +00:00
Co-authored-by: Undefinedor <wanghao@imwh.net>
This commit is contained in:
parent
f19813e3ee
commit
266cf85510
7 changed files with 3 additions and 44 deletions
|
|
@ -263,11 +263,7 @@ func (api *PrivateDebugAPI) traceChain(ctx context.Context, start, end *types.Bl
|
||||||
task.results[i] = &txTraceResult{Result: res}
|
task.results[i] = &txTraceResult{Result: res}
|
||||||
}
|
}
|
||||||
// Stream the result back to the user or abort on teardown
|
// Stream the result back to the user or abort on teardown
|
||||||
select {
|
results <- task
|
||||||
case results <- task:
|
|
||||||
case <-notifier.Closed():
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
@ -299,12 +295,6 @@ func (api *PrivateDebugAPI) traceChain(ctx context.Context, start, end *types.Bl
|
||||||
}()
|
}()
|
||||||
// Feed all the blocks both into the tracer, as well as fast process concurrently
|
// Feed all the blocks both into the tracer, as well as fast process concurrently
|
||||||
for number = start.NumberU64() + 1; number <= end.NumberU64(); number++ {
|
for number = start.NumberU64() + 1; number <= end.NumberU64(); number++ {
|
||||||
// Stop tracing if interruption was requested
|
|
||||||
select {
|
|
||||||
case <-notifier.Closed():
|
|
||||||
return
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
// Print progress logs if long enough time elapsed
|
// Print progress logs if long enough time elapsed
|
||||||
if time.Since(logged) > 8*time.Second {
|
if time.Since(logged) > 8*time.Second {
|
||||||
if number > origin {
|
if number > origin {
|
||||||
|
|
@ -325,11 +315,7 @@ func (api *PrivateDebugAPI) traceChain(ctx context.Context, start, end *types.Bl
|
||||||
if number > origin {
|
if number > origin {
|
||||||
txs := block.Transactions()
|
txs := block.Transactions()
|
||||||
|
|
||||||
select {
|
tasks <- &blockTraceTask{statedb: statedb.Copy(), block: block, rootref: proot, results: make([]*txTraceResult, len(txs))}
|
||||||
case tasks <- &blockTraceTask{statedb: statedb.Copy(), block: block, rootref: proot, results: make([]*txTraceResult, len(txs))}:
|
|
||||||
case <-notifier.Closed():
|
|
||||||
return
|
|
||||||
}
|
|
||||||
traced += uint64(len(txs))
|
traced += uint64(len(txs))
|
||||||
}
|
}
|
||||||
feeCapacity := state.GetTRC21FeeCapacityFromState(statedb)
|
feeCapacity := state.GetTRC21FeeCapacityFromState(statedb)
|
||||||
|
|
|
||||||
|
|
@ -109,9 +109,6 @@ func (api *PublicDownloaderAPI) Syncing(ctx context.Context) (*rpc.Subscription,
|
||||||
case <-rpcSub.Err():
|
case <-rpcSub.Err():
|
||||||
sub.Unsubscribe()
|
sub.Unsubscribe()
|
||||||
return
|
return
|
||||||
case <-notifier.Closed():
|
|
||||||
sub.Unsubscribe()
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,6 @@ import (
|
||||||
"github.com/XinFinOrg/XDPoSChain/common"
|
"github.com/XinFinOrg/XDPoSChain/common"
|
||||||
"github.com/XinFinOrg/XDPoSChain/common/hexutil"
|
"github.com/XinFinOrg/XDPoSChain/common/hexutil"
|
||||||
"github.com/XinFinOrg/XDPoSChain/core/types"
|
"github.com/XinFinOrg/XDPoSChain/core/types"
|
||||||
|
|
||||||
// "github.com/XinFinOrg/XDPoSChain/ethdb"
|
|
||||||
"github.com/XinFinOrg/XDPoSChain/rpc"
|
"github.com/XinFinOrg/XDPoSChain/rpc"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -167,9 +165,6 @@ func (api *FilterAPI) NewPendingTransactions(ctx context.Context) (*rpc.Subscrip
|
||||||
case <-rpcSub.Err():
|
case <-rpcSub.Err():
|
||||||
pendingTxSub.Unsubscribe()
|
pendingTxSub.Unsubscribe()
|
||||||
return
|
return
|
||||||
case <-notifier.Closed():
|
|
||||||
pendingTxSub.Unsubscribe()
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
@ -232,9 +227,6 @@ func (api *FilterAPI) NewHeads(ctx context.Context) (*rpc.Subscription, error) {
|
||||||
case <-rpcSub.Err():
|
case <-rpcSub.Err():
|
||||||
headersSub.Unsubscribe()
|
headersSub.Unsubscribe()
|
||||||
return
|
return
|
||||||
case <-notifier.Closed():
|
|
||||||
headersSub.Unsubscribe()
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
@ -270,9 +262,6 @@ func (api *FilterAPI) Logs(ctx context.Context, crit FilterCriteria) (*rpc.Subsc
|
||||||
case <-rpcSub.Err(): // client send an unsubscribe request
|
case <-rpcSub.Err(): // client send an unsubscribe request
|
||||||
logsSub.Unsubscribe()
|
logsSub.Unsubscribe()
|
||||||
return
|
return
|
||||||
case <-notifier.Closed(): // connection dropped
|
|
||||||
logsSub.Unsubscribe()
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
|
||||||
|
|
@ -147,8 +147,6 @@ func (api *privateAdminAPI) PeerEvents(ctx context.Context) (*rpc.Subscription,
|
||||||
return
|
return
|
||||||
case <-rpcSub.Err():
|
case <-rpcSub.Err():
|
||||||
return
|
return
|
||||||
case <-notifier.Closed():
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
|
||||||
|
|
@ -269,8 +269,6 @@ func (t *TestAPI) Events(ctx context.Context) (*rpc.Subscription, error) {
|
||||||
return
|
return
|
||||||
case <-rpcSub.Err():
|
case <-rpcSub.Err():
|
||||||
return
|
return
|
||||||
case <-notifier.Closed():
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
|
||||||
|
|
@ -145,12 +145,6 @@ func (n *Notifier) Notify(id ID, data any) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Closed returns a channel that is closed when the RPC connection is closed.
|
|
||||||
// Deprecated: use subscription error channel
|
|
||||||
func (n *Notifier) Closed() <-chan interface{} {
|
|
||||||
return n.h.conn.closed()
|
|
||||||
}
|
|
||||||
|
|
||||||
// takeSubscription returns the subscription (if one has been created). No subscription can
|
// takeSubscription returns the subscription (if one has been created). No subscription can
|
||||||
// be created after this call.
|
// be created after this call.
|
||||||
func (n *Notifier) takeSubscription() *Subscription {
|
func (n *Notifier) takeSubscription() *Subscription {
|
||||||
|
|
|
||||||
|
|
@ -195,10 +195,7 @@ func (s *notificationTestService) SomeSubscription(ctx context.Context, n, val i
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
select {
|
<-subscription.Err()
|
||||||
case <-notifier.Closed():
|
|
||||||
case <-subscription.Err():
|
|
||||||
}
|
|
||||||
if s.unsubscribed != nil {
|
if s.unsubscribed != nil {
|
||||||
s.unsubscribed <- string(subscription.ID)
|
s.unsubscribed <- string(subscription.ID)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue