MCPcopy Create free account
hub / github.com/CPChain/chain / WritePrivateReceipt

Function WritePrivateReceipt

core/private_database.go:53–61  ·  view source on GitHub ↗

WritePrivateReceipt writes private receipt associated with specified transaction.

(receipt *types.Receipt, txHash common.Hash, db database.Database)

Source from the content-addressed store, hash-verified

51
52// WritePrivateReceipt writes private receipt associated with specified transaction.
53func WritePrivateReceipt(receipt *types.Receipt, txHash common.Hash, db database.Database) error {
54 hash := getPrivateReceiptKey(txHash)
55 // Write receipt to trie db.
56 storageReceipt := (*types.ReceiptForStorage)(receipt)
57 bytesToWrite, _ := rlp.EncodeToBytes(storageReceipt)
58 db.Put(hash.Bytes(), bytesToWrite)
59 log.Info("Write private transaction receipt", "hash", hash.String(), "receipt", fmt.Sprintf("%+v", receipt))
60 return nil
61}
62
63// ReadPrivateReceipt reads private receipt associated with specified transaction.
64func ReadPrivateReceipt(txHash common.Hash, db database.Database) (*types.Receipt, error) {

Callers 3

TestWritePrivateReceiptFunction · 0.85
TestReadPrivateReceiptFunction · 0.85
WriteBlockWithStateMethod · 0.85

Calls 5

getPrivateReceiptKeyFunction · 0.85
PutMethod · 0.65
BytesMethod · 0.65
InfoMethod · 0.65
StringMethod · 0.45

Tested by 2

TestWritePrivateReceiptFunction · 0.68
TestReadPrivateReceiptFunction · 0.68