Skip to content

Commit 768da69

Browse files
committed
fix logic
1 parent 7f09c70 commit 768da69

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

core/rawdb/accessors_skipped_txs.go

+18
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,24 @@ func WriteSkippedTransaction(db ethdb.Database, tx *types.Transaction, traces *t
181181
}
182182
}
183183

184+
func ResetSkippedTransactionTracesByHash(db ethdb.Database, txHash common.Hash) {
185+
mu.Lock()
186+
defer mu.Unlock()
187+
188+
data := readSkippedTransactionRLP(db, txHash)
189+
if len(data) == 0 {
190+
return
191+
}
192+
var stx SkippedTransaction
193+
if err := rlp.Decode(bytes.NewReader(data), &stx); err != nil {
194+
log.Crit("Invalid skipped transaction RLP", "hash", txHash.String(), "data", data, "err", err)
195+
}
196+
if stx.BlockHash != nil && *stx.BlockHash == (common.Hash{}) {
197+
stx.BlockHash = nil
198+
}
199+
writeSkippedTransaction(db, stx.Tx, nil, stx.Reason, stx.BlockNumber, stx.BlockHash)
200+
}
201+
184202
// SkippedTransactionIterator is a wrapper around ethdb.Iterator that
185203
// allows us to iterate over skipped transaction hashes in the database.
186204
// It implements an interface similar to ethdb.Iterator.

eth/api.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,6 @@ func (api *ScrollAPI) ResetSkippedTransactionsTraces(ctx context.Context, from u
778778
}
779779

780780
func (api *ScrollAPI) ResetSkippedTransactionTracesByHash(ctx context.Context, hash common.Hash) error {
781-
stx := rawdb.ReadSkippedTransaction(api.eth.ChainDb(), hash)
782-
rawdb.WriteSkippedTransaction(api.eth.ChainDb(), stx.Tx, nil, stx.Reason, stx.BlockNumber, stx.BlockHash)
781+
rawdb.ResetSkippedTransactionTracesByHash(api.eth.ChainDb(), hash)
783782
return nil
784783
}

0 commit comments

Comments
 (0)