Revert "feat: seed brc20 stats"

This reverts commit 4ae169218f.

# Conflicts:
#	modules/brc20/constants.go
This commit is contained in:
Gaze
2024-05-29 17:29:05 +07:00
parent f0cb5d651b
commit dc44e4bb5c
3 changed files with 10 additions and 29 deletions

View File

@@ -4,7 +4,7 @@ import (
"github.com/Cleverse/go-utilities/utils"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/gaze-network/indexer-network/common"
"github.com/gaze-network/indexer-network/modules/brc20/internal/entity"
"github.com/gaze-network/indexer-network/core/types"
)
const (
@@ -13,29 +13,13 @@ const (
EventHashVersion = 1
)
type StartingBlockData struct {
Height int64
Hash chainhash.Hash
Stats entity.ProcessorStats
}
var startingBlockData = map[common.Network]StartingBlockData{
var startingBlockHeader = map[common.Network]types.BlockHeader{
common.NetworkMainnet: {
Height: 779831, // first brc20 inscription
Hash: *utils.Must(chainhash.NewHashFromStr("00000000000000000003f079883a81997d3238b287ea53904f1ecd3d1f225209")),
Stats: entity.ProcessorStats{ // need to seed these stats to keep sequence number the same
CursedInscriptionCount: 155,
BlessedInscriptionCount: 348020,
LostSats: 0, // TODO: need to check lost sats at block 779831
},
Height: 767429,
Hash: *utils.Must(chainhash.NewHashFromStr("00000000000000000002b35aef66eb15cd2b232a800f75a2f25cedca4cfe52c4")),
},
common.NetworkTestnet: {
Height: 2413342,
Hash: *utils.Must(chainhash.NewHashFromStr("00000000000022e97030b143af785de812f836dd0651b6ac2b7dd9e90dc9abf9")),
Stats: entity.ProcessorStats{
CursedInscriptionCount: 0,
BlessedInscriptionCount: 0,
LostSats: 0,
},
},
}

View File

@@ -110,10 +110,10 @@ func (p *Processor) VerifyStates(ctx context.Context) error {
return errors.Wrap(err, "failed to count cursed inscriptions")
}
stats = &entity.ProcessorStats{
BlockHeight: uint64(startingBlockData[p.network].Height),
CursedInscriptionCount: startingBlockData[p.network].Stats.CursedInscriptionCount,
BlessedInscriptionCount: startingBlockData[p.network].Stats.BlessedInscriptionCount,
LostSats: startingBlockData[p.network].Stats.LostSats,
BlockHeight: uint64(startingBlockHeader[p.network].Height),
CursedInscriptionCount: 0,
BlessedInscriptionCount: 0,
LostSats: 0,
}
}
p.cursedInscriptionCount = stats.CursedInscriptionCount
@@ -127,10 +127,7 @@ func (p *Processor) CurrentBlock(ctx context.Context) (types.BlockHeader, error)
blockHeader, err := p.brc20Dg.GetLatestBlock(ctx)
if err != nil {
if errors.Is(err, errs.NotFound) {
return types.BlockHeader{
Height: startingBlockData[p.network].Height,
Hash: startingBlockData[p.network].Hash,
}, nil
return startingBlockHeader[p.network], nil
}
return types.BlockHeader{}, errors.Wrap(err, "failed to get latest block")
}

View File

@@ -243,7 +243,7 @@ func (p *Processor) processInscriptionTx(ctx context.Context, tx *types.Transact
satPoint := loc.satPoint
flotsam := loc.flotsam
sentAsFee := loc.sentAsFee
// TODO: not sure if we still need to handle pointer here, it's already handled above. (referred from ord)
// TODO: not sure if we still need to handle pointer here, it's already handled above.
if flotsam.OriginNew != nil && flotsam.OriginNew.Pointer != nil {
pointer := *flotsam.OriginNew.Pointer
for outIndex, outputValue := range outputToSumValue {