mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-12 06:53:46 +00:00
Merge branch 'ethereum:master' into portal
This commit is contained in:
commit
a66e1aa6a0
4 changed files with 10 additions and 10 deletions
|
|
@ -95,7 +95,7 @@ func NewFilterSystem(backend Backend, config Config) *FilterSystem {
|
||||||
|
|
||||||
type logCacheElem struct {
|
type logCacheElem struct {
|
||||||
logs []*types.Log
|
logs []*types.Log
|
||||||
body atomic.Value
|
body atomic.Pointer[types.Body]
|
||||||
}
|
}
|
||||||
|
|
||||||
// cachedLogElem loads block logs from the backend and caches the result.
|
// cachedLogElem loads block logs from the backend and caches the result.
|
||||||
|
|
@ -133,7 +133,7 @@ func (sys *FilterSystem) cachedLogElem(ctx context.Context, blockHash common.Has
|
||||||
|
|
||||||
func (sys *FilterSystem) cachedGetBody(ctx context.Context, elem *logCacheElem, hash common.Hash, number uint64) (*types.Body, error) {
|
func (sys *FilterSystem) cachedGetBody(ctx context.Context, elem *logCacheElem, hash common.Hash, number uint64) (*types.Body, error) {
|
||||||
if body := elem.body.Load(); body != nil {
|
if body := elem.body.Load(); body != nil {
|
||||||
return body.(*types.Body), nil
|
return body, nil
|
||||||
}
|
}
|
||||||
body, err := sys.backend.GetBody(ctx, hash, rpc.BlockNumber(number))
|
body, err := sys.backend.GetBody(ctx, hash, rpc.BlockNumber(number))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -340,7 +340,7 @@ func writeTimeTermFormat(buf *bytes.Buffer, t time.Time) {
|
||||||
|
|
||||||
// writePosIntWidth writes non-negative integer i to the buffer, padded on the left
|
// writePosIntWidth writes non-negative integer i to the buffer, padded on the left
|
||||||
// by zeroes to the given width. Use a width of 0 to omit padding.
|
// by zeroes to the given width. Use a width of 0 to omit padding.
|
||||||
// Adapted from golang.org/x/exp/slog/internal/buffer/buffer.go
|
// Adapted from pkg.go.dev/log/slog/internal/buffer
|
||||||
func writePosIntWidth(b *bytes.Buffer, i, width int) {
|
func writePosIntWidth(b *bytes.Buffer, i, width int) {
|
||||||
// Cheap integer to fixed-width decimal ASCII.
|
// Cheap integer to fixed-width decimal ASCII.
|
||||||
// Copied from log/log.go.
|
// Copied from log/log.go.
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ package rlp
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"maps"
|
||||||
"reflect"
|
"reflect"
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
|
@ -90,10 +91,7 @@ func (c *typeCache) generate(typ reflect.Type, tags rlpstruct.Tags) *typeinfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy cur to next.
|
// Copy cur to next.
|
||||||
c.next = make(map[typekey]*typeinfo, len(cur)+1)
|
c.next = maps.Clone(cur)
|
||||||
for k, v := range cur {
|
|
||||||
c.next[k] = v
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generate.
|
// Generate.
|
||||||
info := c.infoWhileGenerating(typ, tags)
|
info := c.infoWhileGenerating(typ, tags)
|
||||||
|
|
|
||||||
|
|
@ -25,14 +25,16 @@ import (
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"syscall"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/log"
|
"github.com/ethereum/go-ethereum/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// On Linux, sun_path is 108 bytes in size
|
// The limit of unix domain socket path diverse between OS, on Darwin it's 104 bytes
|
||||||
// see http://man7.org/linux/man-pages/man7/unix.7.html
|
// but on Linux it's 108 byte, so we should depend on syscall.RawSockaddrUnix's
|
||||||
maxPathSize = int(108)
|
// definition dynamically
|
||||||
|
maxPathSize = len(syscall.RawSockaddrUnix{}.Path)
|
||||||
)
|
)
|
||||||
|
|
||||||
// ipcListen will create a Unix socket on the given endpoint.
|
// ipcListen will create a Unix socket on the given endpoint.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue