mirror of
https://github.com/alexgo-io/libbrc20-indexer.git
synced 2026-01-12 16:53:11 +08:00
feat: ENABLE_SELF_MINT_HEIGHT as a conf
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"flag"
|
||||
"log"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
"github.com/unisat-wallet/libbrc20-indexer/conf"
|
||||
@@ -37,6 +38,12 @@ func init() {
|
||||
if id := os.Getenv("MODULE_SWAP_SOURCE_INSCRIPTION_ID"); id != "" {
|
||||
conf.MODULE_SWAP_SOURCE_INSCRIPTION_ID = id
|
||||
}
|
||||
|
||||
if heightStr := os.Getenv("BRC20_ENABLE_SELF_MINT_HEIGHT"); heightStr != "" {
|
||||
if h, err := strconv.Atoi(heightStr); err != nil {
|
||||
conf.ENABLE_SELF_MINT_HEIGHT = uint32(h)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
@@ -9,4 +9,5 @@ var (
|
||||
MODULE_SWAP_SOURCE_INSCRIPTION_ID = "d2a30f6131324e06b1366876c8c089d7ad2a9c2b0ea971c5b0dc6198615bda2ei0"
|
||||
GlobalNetParams = &chaincfg.MainNetParams
|
||||
TICKS_ENABLED = ""
|
||||
ENABLE_SELF_MINT_HEIGHT uint32 = 837090
|
||||
)
|
||||
|
||||
@@ -31,7 +31,7 @@ func (g *BRC20ModuleIndexer) ProcessDeploy(data *model.InscriptionBRC20Data) err
|
||||
return nil
|
||||
// return errors.New("deploy, tick length 5, but not self_mint")
|
||||
}
|
||||
if data.Height < g.EnableSelfMintHeight {
|
||||
if data.Height < conf.ENABLE_SELF_MINT_HEIGHT {
|
||||
return nil
|
||||
// return errors.New("deploy, tick length 5, but not enabled")
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import (
|
||||
|
||||
type BRC20ModuleIndexer struct {
|
||||
BestHeight uint32
|
||||
EnableSelfMintHeight uint32
|
||||
EnableHistory bool
|
||||
|
||||
HistoryCount uint32
|
||||
@@ -108,6 +107,7 @@ func (g *BRC20ModuleIndexer) UpdateHistoryHeightAndGetHistoryIndex(historyObj *m
|
||||
func (g *BRC20ModuleIndexer) initBRC20() {
|
||||
g.EnableHistory = true
|
||||
g.BestHeight = 0
|
||||
|
||||
g.HistoryCount = 0
|
||||
g.HistoryData = make([][]byte, 0)
|
||||
|
||||
@@ -237,7 +237,6 @@ func (g *BRC20ModuleIndexer) GenerateApproveEventsByApprove(owner string, balanc
|
||||
func (copyDup *BRC20ModuleIndexer) deepCopyBRC20Data(base *BRC20ModuleIndexer) {
|
||||
// history
|
||||
copyDup.BestHeight = base.BestHeight
|
||||
copyDup.EnableSelfMintHeight = base.EnableSelfMintHeight
|
||||
copyDup.EnableHistory = base.EnableHistory
|
||||
copyDup.HistoryCount = base.HistoryCount
|
||||
|
||||
|
||||
Reference in New Issue
Block a user