rawdb: Add WriteTxLookupEntry

This commit is contained in:
CocoaHuke 2018-06-22 01:19:21 -07:00
parent 1520f8ffbe
commit c7ef06016a
No known key found for this signature in database
GPG key ID: E300819C1AE33223

View file

@ -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))