mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 02:40:45 +00:00
parent
df837a0c8b
commit
9ad6312396
1 changed files with 12 additions and 6 deletions
|
|
@ -153,7 +153,9 @@ func (ec *Client) getBlock(ctx context.Context, method string, args ...interface
|
||||||
// Fill the sender cache of transactions in the block.
|
// Fill the sender cache of transactions in the block.
|
||||||
txs := make([]*types.Transaction, len(body.Transactions))
|
txs := make([]*types.Transaction, len(body.Transactions))
|
||||||
for i, tx := range body.Transactions {
|
for i, tx := range body.Transactions {
|
||||||
setSenderFromServer(tx.tx, tx.From, body.Hash)
|
if tx.From != nil {
|
||||||
|
setSenderFromServer(tx.tx, *tx.From, body.Hash)
|
||||||
|
}
|
||||||
txs[i] = tx.tx
|
txs[i] = tx.tx
|
||||||
}
|
}
|
||||||
return types.NewBlockWithHeader(head).WithBody(txs, uncles), nil
|
return types.NewBlockWithHeader(head).WithBody(txs, uncles), nil
|
||||||
|
|
@ -186,9 +188,9 @@ type rpcTransaction struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type txExtraInfo struct {
|
type txExtraInfo struct {
|
||||||
BlockNumber *string
|
BlockNumber *string `json:"blockNumber,omitempty"`
|
||||||
BlockHash common.Hash
|
BlockHash *common.Hash `json:"blockHash,omitempty"`
|
||||||
From common.Address
|
From *common.Address `json:"from,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tx *rpcTransaction) UnmarshalJSON(msg []byte) error {
|
func (tx *rpcTransaction) UnmarshalJSON(msg []byte) error {
|
||||||
|
|
@ -209,7 +211,9 @@ func (ec *Client) TransactionByHash(ctx context.Context, hash common.Hash) (tx *
|
||||||
} else if _, r, _ := json.tx.RawSignatureValues(); r == nil {
|
} else if _, r, _ := json.tx.RawSignatureValues(); r == nil {
|
||||||
return nil, false, errors.New("server returned transaction without signature")
|
return nil, false, errors.New("server returned transaction without signature")
|
||||||
}
|
}
|
||||||
setSenderFromServer(json.tx, json.From, json.BlockHash)
|
if json.From != nil && json.BlockHash != nil {
|
||||||
|
setSenderFromServer(json.tx, *json.From, *json.BlockHash)
|
||||||
|
}
|
||||||
return json.tx, json.BlockNumber == nil, nil
|
return json.tx, json.BlockNumber == nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -256,7 +260,9 @@ func (ec *Client) TransactionInBlock(ctx context.Context, blockHash common.Hash,
|
||||||
return nil, errors.New("server returned transaction without signature")
|
return nil, errors.New("server returned transaction without signature")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setSenderFromServer(json.tx, json.From, json.BlockHash)
|
if json.From != nil && json.BlockHash != nil {
|
||||||
|
setSenderFromServer(json.tx, *json.From, *json.BlockHash)
|
||||||
|
}
|
||||||
return json.tx, err
|
return json.tx, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue