forked from cerc-io/ipld-eth-server
fix transaction signing, also removes need for rpc call to do it
This commit is contained in:
parent
e72995605d
commit
89faa85871
@ -17,14 +17,11 @@
|
|||||||
package ipfs
|
package ipfs
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
|
"github.com/ethereum/go-ethereum/params"
|
||||||
"github.com/ethereum/go-ethereum/rlp"
|
"github.com/ethereum/go-ethereum/rlp"
|
||||||
"github.com/ethereum/go-ethereum/statediff"
|
"github.com/ethereum/go-ethereum/statediff"
|
||||||
|
|
||||||
"github.com/vulcanize/vulcanizedb/pkg/core"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// PayloadConverter interface is used to convert a geth statediff.Payload to our IPLDPayload type
|
// PayloadConverter interface is used to convert a geth statediff.Payload to our IPLDPayload type
|
||||||
@ -34,13 +31,13 @@ type PayloadConverter interface {
|
|||||||
|
|
||||||
// Converter is the underlying struct for the PayloadConverter interface
|
// Converter is the underlying struct for the PayloadConverter interface
|
||||||
type Converter struct {
|
type Converter struct {
|
||||||
client core.EthClient
|
chainConfig *params.ChainConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewPayloadConverter creates a pointer to a new Converter which satisfies the PayloadConverter interface
|
// NewPayloadConverter creates a pointer to a new Converter which satisfies the PayloadConverter interface
|
||||||
func NewPayloadConverter(client core.EthClient) *Converter {
|
func NewPayloadConverter(chainConfig *params.ChainConfig) *Converter {
|
||||||
return &Converter{
|
return &Converter{
|
||||||
client: client,
|
chainConfig: chainConfig,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,9 +66,10 @@ func (pc *Converter) Convert(payload statediff.Payload) (*IPLDPayload, error) {
|
|||||||
StateNodes: make(map[common.Hash]StateNode),
|
StateNodes: make(map[common.Hash]StateNode),
|
||||||
StorageNodes: make(map[common.Hash][]StorageNode),
|
StorageNodes: make(map[common.Hash][]StorageNode),
|
||||||
}
|
}
|
||||||
for gethTransactionIndex, trx := range block.Transactions() {
|
signer := types.MakeSigner(pc.chainConfig, block.Number())
|
||||||
|
for _, trx := range block.Transactions() {
|
||||||
// Extract to and from data from the the transactions for indexing
|
// Extract to and from data from the the transactions for indexing
|
||||||
from, err := pc.client.TransactionSender(context.Background(), trx, block.Hash(), uint(gethTransactionIndex))
|
from, err := types.Sender(signer, trx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,8 @@ package seed_node
|
|||||||
import (
|
import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"github.com/ethereum/go-ethereum/params"
|
||||||
|
|
||||||
"github.com/vulcanize/vulcanizedb/libraries/shared/streamer"
|
"github.com/vulcanize/vulcanizedb/libraries/shared/streamer"
|
||||||
"github.com/vulcanize/vulcanizedb/pkg/ipfs"
|
"github.com/vulcanize/vulcanizedb/pkg/ipfs"
|
||||||
|
|
||||||
@ -98,7 +100,7 @@ func NewProcessor(ipfsPath string, db *postgres.DB, ethClient core.EthClient, rp
|
|||||||
return &Service{
|
return &Service{
|
||||||
Streamer: streamer.NewStateDiffStreamer(rpcClient),
|
Streamer: streamer.NewStateDiffStreamer(rpcClient),
|
||||||
Repository: NewCIDRepository(db),
|
Repository: NewCIDRepository(db),
|
||||||
Converter: ipfs.NewPayloadConverter(ethClient),
|
Converter: ipfs.NewPayloadConverter(params.MainnetChainConfig),
|
||||||
Publisher: publisher,
|
Publisher: publisher,
|
||||||
Filterer: NewResponseFilterer(),
|
Filterer: NewResponseFilterer(),
|
||||||
Fetcher: fetcher,
|
Fetcher: fetcher,
|
||||||
|
Loading…
Reference in New Issue
Block a user