Skip to content

Commit 2b47f49

Browse files
jkawanJenita
andauthored
feat: track transaction metadata (#980)
Signed-off-by: Jenita <jkawan@blinklabs.io> Signed-off-by: jkawan <kawanjenita@outlook.com> Co-authored-by: Jenita <jkawan@blinklabs.io>
1 parent 5866573 commit 2b47f49

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

database/models/transaction.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ type Transaction struct {
2626
ID uint `gorm:"primaryKey"`
2727
Type int
2828
BlockIndex uint32
29+
Metadata []byte
2930
}
3031

3132
func (Transaction) TableName() string {

database/plugin/metadata/sqlite/transaction.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ func (d *MetadataStoreSqlite) SetTransaction(
6464
BlockHash: point.Hash,
6565
BlockIndex: idx,
6666
}
67+
if tx.Metadata() != nil {
68+
tmpMetadata := tx.Metadata().Cbor()
69+
tmpTx.Metadata = tmpMetadata
70+
}
6771
collateralReturn := tx.CollateralReturn()
6872
for _, utxo := range tx.Produced() {
6973
if collateralReturn != nil && utxo.Output == collateralReturn {

0 commit comments

Comments
 (0)