MCPcopy Create free account
hub / github.com/DNAProject/DNA / saveTransaction

Method saveTransaction

validator/db/store.go:163–175  ·  view source on GitHub ↗
(tx *types.Transaction, height uint32)

Source from the content-addressed store, hash-verified

161}
162
163func (self *Store) saveTransaction(tx *types.Transaction, height uint32) error {
164 // generate key with DATA_TRANSACTION prefix
165 key := GenDataTransactionKey(tx.Hash())
166 defer keyPool.Put(key)
167
168 value := common.NewZeroCopySink(nil)
169 value.WriteUint32(height)
170 tx.Serialization(value)
171
172 // put value
173 self.db.BatchPut(key.Bytes(), value.Bytes())
174 return nil
175}
176
177func (self *Store) PersistBlock(block *types.Block) error {
178 height := block.Header.Height

Callers 1

PersistBlockMethod · 0.95

Calls 7

WriteUint32Method · 0.95
BytesMethod · 0.95
GenDataTransactionKeyFunction · 0.85
HashMethod · 0.65
PutMethod · 0.65
SerializationMethod · 0.65
BatchPutMethod · 0.65

Tested by

no test coverage detected