Merge branch 'ethereum:master' into portal

This commit is contained in:
Chen Kai 2024-04-02 19:01:31 +08:00 committed by GitHub
commit a66e1aa6a0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 10 additions and 10 deletions

View file

@ -95,7 +95,7 @@ func NewFilterSystem(backend Backend, config Config) *FilterSystem {
type logCacheElem struct {
logs []*types.Log
body atomic.Value
body atomic.Pointer[types.Body]
}
// 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) {
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))
if err != nil {

View file

@ -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
// 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) {
// Cheap integer to fixed-width decimal ASCII.
// Copied from log/log.go.

View file

@ -18,6 +18,7 @@ package rlp
import (
"fmt"
"maps"
"reflect"
"sync"
"sync/atomic"
@ -90,10 +91,7 @@ func (c *typeCache) generate(typ reflect.Type, tags rlpstruct.Tags) *typeinfo {
}
// Copy cur to next.
c.next = make(map[typekey]*typeinfo, len(cur)+1)
for k, v := range cur {
c.next[k] = v
}
c.next = maps.Clone(cur)
// Generate.
info := c.infoWhileGenerating(typ, tags)

View file

@ -25,14 +25,16 @@ import (
"net"
"os"
"path/filepath"
"syscall"
"github.com/ethereum/go-ethereum/log"
)
const (
// On Linux, sun_path is 108 bytes in size
// see http://man7.org/linux/man-pages/man7/unix.7.html
maxPathSize = int(108)
// The limit of unix domain socket path diverse between OS, on Darwin it's 104 bytes
// but on Linux it's 108 byte, so we should depend on syscall.RawSockaddrUnix's
// definition dynamically
maxPathSize = len(syscall.RawSockaddrUnix{}.Path)
)
// ipcListen will create a Unix socket on the given endpoint.