MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / addTx

Function addTx

blockproducer/storage.go:194–210  ·  view source on GitHub ↗
(t pi.Transaction)

Source from the content-addressed store, hash-verified

192}
193
194func addTx(t pi.Transaction) storageProcedure {
195 var (
196 enc *bytes.Buffer
197 err error
198 )
199 if enc, err = utils.EncodeMsgPack(t); err != nil {
200 return errPass(err)
201 }
202 return func(tx *sql.Tx) (err error) {
203 _, err = tx.Exec(`INSERT OR REPLACE INTO "txPool" ("type", "hash", "encoded")
204 VALUES (?, ?, ?)`,
205 uint32(t.GetTransactionType()),
206 t.Hash().String(),
207 enc.Bytes())
208 return err
209 }
210}
211
212func buildBlockIndex(height uint32, b *types.BPBlock) storageProcedure {
213 return func(tx *sql.Tx) (err error) {

Callers 1

storeTxMethod · 0.85

Calls 7

EncodeMsgPackFunction · 0.92
errPassFunction · 0.85
ExecMethod · 0.65
GetTransactionTypeMethod · 0.65
HashMethod · 0.65
StringMethod · 0.45
BytesMethod · 0.45

Tested by

no test coverage detected