mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 21:56:43 +00:00
fix(rawdb, api): fix rawdb.writeSkippedTransaction & api.GetSkippedTransaction (#503)
* fix(rawsdb): fix `writeSkippedTransaction` * Update version.go * minor * clean up
This commit is contained in:
parent
c75ebdbdb0
commit
dade96d416
3 changed files with 10 additions and 6 deletions
|
|
@ -86,15 +86,17 @@ type SkippedTransactionV2 struct {
|
|||
|
||||
// writeSkippedTransaction writes a skipped transaction to the database.
|
||||
func writeSkippedTransaction(db ethdb.KeyValueWriter, tx *types.Transaction, traces *types.BlockTrace, reason string, blockNumber uint64, blockHash *common.Hash) {
|
||||
var err error
|
||||
// workaround: RLP decoding fails if this is nil
|
||||
if blockHash == nil {
|
||||
blockHash = &common.Hash{}
|
||||
}
|
||||
b, err := json.Marshal(traces)
|
||||
if err != nil {
|
||||
log.Crit("Failed to json marshal skipped transaction", "hash", tx.Hash().String(), "err", err)
|
||||
stx := SkippedTransactionV2{Tx: tx, Reason: reason, BlockNumber: blockNumber, BlockHash: blockHash}
|
||||
if traces != nil {
|
||||
if stx.TracesBytes, err = json.Marshal(traces); err != nil {
|
||||
log.Crit("Failed to json marshal skipped transaction", "hash", tx.Hash().String(), "err", err)
|
||||
}
|
||||
}
|
||||
stx := SkippedTransactionV2{Tx: tx, TracesBytes: b, Reason: reason, BlockNumber: blockNumber, BlockHash: blockHash}
|
||||
bytes, err := rlp.EncodeToBytes(stx)
|
||||
if err != nil {
|
||||
log.Crit("Failed to RLP encode skipped transaction", "hash", tx.Hash().String(), "err", err)
|
||||
|
|
|
|||
|
|
@ -738,9 +738,11 @@ func (api *ScrollAPI) GetSkippedTransaction(ctx context.Context, hash common.Has
|
|||
rpcTx.SkipBlockNumber = (*hexutil.Big)(new(big.Int).SetUint64(stx.BlockNumber))
|
||||
rpcTx.SkipBlockHash = stx.BlockHash
|
||||
if len(stx.TracesBytes) != 0 {
|
||||
if err := json.Unmarshal(stx.TracesBytes, rpcTx.Traces); err != nil {
|
||||
traces := &types.BlockTrace{}
|
||||
if err := json.Unmarshal(stx.TracesBytes, traces); err != nil {
|
||||
return nil, fmt.Errorf("fail to Unmarshal traces for skipped tx, hash: %s, err: %w", hash.String(), err)
|
||||
}
|
||||
rpcTx.Traces = traces
|
||||
}
|
||||
return &rpcTx, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import (
|
|||
const (
|
||||
VersionMajor = 4 // Major version component of the current release
|
||||
VersionMinor = 4 // Minor version component of the current release
|
||||
VersionPatch = 1 // Patch version component of the current release
|
||||
VersionPatch = 2 // Patch version component of the current release
|
||||
VersionMeta = "sepolia" // Version metadata to append to the version string
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue