Skip to content

Commit

Permalink
+ ConfirmTxIndexer
Browse files Browse the repository at this point in the history
  • Loading branch information
jojoin committed Feb 23, 2024
1 parent 97ec817 commit be0ec02
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions run/main/main.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
package main

import (
"encoding/hex"
"fmt"
"github.com/hacash/core/blocks"
"github.com/hacash/core/interfaces"
"github.com/hacash/core/interfacev2"
"github.com/hacash/core/sys"
"github.com/hacash/miner/console"
"github.com/hacash/miner/device"
"github.com/hacash/miner/diamondminer"
"github.com/hacash/miner/interfaces"
minerinterfaces "github.com/hacash/miner/interfaces"

"github.com/hacash/miner/memtxpool"
"github.com/hacash/miner/miner"
Expand Down Expand Up @@ -161,6 +163,9 @@ func start() error {
// hnode set tx pool
hnode.SetTxPool(txpool)

// indexer text
// hnode.BlockChain().GetChainEngineKernel().SetConfirmTxIndexer(&TestTxIndexer{})

// start
err = hnode.Start()
if err != nil {
Expand Down Expand Up @@ -226,7 +231,7 @@ func start() error {

// full node local cpu & GPU
mnrcnf := device.NewConfig(hinicnf.Section("miner"))
var mining_exec interfaces.PoWExecute = nil
var mining_exec minerinterfaces.PoWExecute = nil
/*
if isOpenMinerGPU {
powexec := gpuexec.NewGPUExecute(mnrcnf)
Expand Down Expand Up @@ -438,3 +443,13 @@ func Test_print_dmdname(state interfacev2.ChainState) {
fmt.Println("\n\n\n\n ")

}

/////////////////////////////////////////////////////

type TestTxIndexer struct{}

func (ix *TestTxIndexer) ScanTx(block interfaces.BlockHeadMetaRead, tx interfaces.Transaction) int8 {
fmt.Printf("---- tx indexer ScanTx ---- %d ---- %s··· ---- \n",
block.GetHeight(), hex.EncodeToString(tx.Hash()[0:4]))
return 0
}

0 comments on commit be0ec02

Please sign in to comment.