Updates to reflect comments on original merge.

This commit is contained in:
philip-morlier 2022-08-22 11:48:26 -07:00
parent 59a823409e
commit 967626b075
3 changed files with 60 additions and 61 deletions

View File

@ -4,7 +4,7 @@ package rawdb
import (
"github.com/ethereum/go-ethereum/plugins"
"github.com/ethereum/go-ethereum/log"
// "github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/rlp"
"sync"
)
@ -57,64 +57,64 @@ func PluginCommitUpdate(pl *plugins.PluginLoader, num uint64) {
fn(i, update)
}
}
_ = pl.Lookup("AppendAncient", func(item interface{}) bool {
appendAncientFnList := pl.Lookup("AppendAncient", func(item interface{}) bool {
_, ok := item.(func(number uint64, hash, header, body, receipts, td []byte))
if ok { log.Warn("PlugEth's AppendAncient is deprecated. Please update to ModifyAncients.") }
if ok { log.Warn("PluGeth's AppendAncient is deprecated. Please update to ModifyAncients.") }
return ok
})
// if len(appendAncientFnList) > 0 {
// var (
// hash []byte
// header []byte
// body []byte
// receipts []byte
// td []byte
// )
// if hashi, ok := update[freezerHashTable]; ok {
// switch v := hashi.(type) {
// case []byte:
// hash = v
// default:
// hash, _ = rlp.EncodeToBytes(v)
// }
// }
// if headeri, ok := update[freezerHeaderTable]; ok {
// switch v := headeri.(type) {
// case []byte:
// header = v
// default:
// header, _ = rlp.EncodeToBytes(v)
// }
// }
// if bodyi, ok := update[freezerBodiesTable]; ok {
// switch v := bodyi.(type) {
// case []byte:
// body = v
// default:
// body, _ = rlp.EncodeToBytes(v)
// }
// }
// if receiptsi, ok := update[freezerReceiptTable]; ok {
// switch v := receiptsi.(type) {
// case []byte:
// receipts = v
// default:
// receipts, _ = rlp.EncodeToBytes(v)
// }
// }
// if tdi, ok := update[freezerDifficultyTable]; ok {
// switch v := tdi.(type) {
// case []byte:
// td = v
// default:
// td, _ = rlp.EncodeToBytes(v)
// }
// }
// for _, fni := range appendAncientFnList {
// if fn, ok := fni.(func(number uint64, hash, header, body, receipts, td []byte)); ok {
// fn(i, hash, header, body, receipts, td)
// }
// }
// }
if len(appendAncientFnList) > 0 {
var (
hash []byte
header []byte
body []byte
receipts []byte
td []byte
)
if hashi, ok := update[chainFreezerHashTable]; ok {
switch v := hashi.(type) {
case []byte:
hash = v
default:
hash, _ = rlp.EncodeToBytes(v)
}
}
if headeri, ok := update[chainFreezerHeaderTable]; ok {
switch v := headeri.(type) {
case []byte:
header = v
default:
header, _ = rlp.EncodeToBytes(v)
}
}
if bodyi, ok := update[chainFreezerBodiesTable]; ok {
switch v := bodyi.(type) {
case []byte:
body = v
default:
body, _ = rlp.EncodeToBytes(v)
}
}
if receiptsi, ok := update[chainFreezerReceiptTable]; ok {
switch v := receiptsi.(type) {
case []byte:
receipts = v
default:
receipts, _ = rlp.EncodeToBytes(v)
}
}
if tdi, ok := update[chainFreezerDifficultyTable]; ok {
switch v := tdi.(type) {
case []byte:
td = v
default:
td, _ = rlp.EncodeToBytes(v)
}
}
for _, fni := range appendAncientFnList {
if fn, ok := fni.(func(number uint64, hash, header, body, receipts, td []byte)); ok {
fn(i, hash, header, body, receipts, td)
}
}
}
}
}

2
go.mod
View File

@ -105,5 +105,3 @@ require (
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
replace github.com/openrelayxyz/plugeth-utils v0.0.18 => ../plugeth-utils

View File

@ -173,8 +173,9 @@ func (b *Backend) TxPoolContent() (map[core.Address][][]byte, map[core.Address][
func (b *Backend) BloomStatus() (uint64, uint64) {
return b.b.BloomStatus()
}
func (b *Backend) GetLogs(ctx context.Context, blockHash core.Hash, number uint64) ([][]byte, error) {
logs, err := b.b.GetLogs(ctx, common.Hash(blockHash), number)
func (b *Backend) GetLogs(ctx context.Context, blockHash core.Hash) ([][]byte, error) {
header, _ := b.b.HeaderByHash(ctx, common.Hash(blockHash))
logs, err := b.b.GetLogs(ctx, common.Hash(blockHash), uint64(header.Number.Uint64()))
if err != nil {
return nil, err
}