From c7ef06016a9428db6718731c7f0dce002eaf590f Mon Sep 17 00:00:00 2001 From: CocoaHuke Date: Fri, 22 Jun 2018 01:19:21 -0700 Subject: [PATCH] rawdb: Add WriteTxLookupEntry --- core/rawdb/accessors_indexes.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/rawdb/accessors_indexes.go b/core/rawdb/accessors_indexes.go index 4ff7e5bd35..fcb06a3a52 100644 --- a/core/rawdb/accessors_indexes.go +++ b/core/rawdb/accessors_indexes.go @@ -57,6 +57,16 @@ func WriteTxLookupEntries(db DatabaseWriter, block *types.Block) { } } +func WriteTxLookupEntry(db DatabaseWriter, entry *TxLookupEntry, txHash common.Hash) { + data, err := rlp.EncodeToBytes(entry) + if err != nil { + log.Crit("Failed to encode transaction lookup entry", "err", err) + } + if err := db.Put(txLookupKey(txHash), data); err != nil { + log.Crit("Failed to store transaction lookup entry", "err", err) + } +} + // DeleteTxLookupEntry removes all transaction data associated with a hash. func DeleteTxLookupEntry(db DatabaseDeleter, hash common.Hash) { db.Delete(txLookupKey(hash))