Skip to content

Commit

Permalink
Dero-Miner MathNodes Release 73
Browse files Browse the repository at this point in the history
  • Loading branch information
MathNodes committed May 3, 2022
1 parent 2271ac5 commit ee95358
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
Binary file modified dero-miner/dero-miner-android-mathnodes
Binary file not shown.
Binary file modified dero-miner/dero-miner-linux-mathnodes
Binary file not shown.
29 changes: 20 additions & 9 deletions dero-miner/miner.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ var our_height int64

var block_counter uint64
var mini_block_counter uint64
var rejected uint64
var logger logr.Logger

var command_line string = `dero-miner
Expand Down Expand Up @@ -282,15 +283,17 @@ func main() {
testnet_string = "\033[31m TESTNET"
}

l.SetPrompt(fmt.Sprintf("\033[1m\033[32mDERO Miner: \033[0m"+color+"Height %d "+pcolor+" BLOCKS %d MiniBlocks %d \033[32mNW %s %s>%s>>\033[0m ", our_height, block_counter, mini_block_counter, hash_rate_string, mining_string, testnet_string))

//added by MathNodes for logging
logger.V(0).Info("", "height", strconv.FormatInt(int64(our_height),10), "blocks", strconv.FormatInt(int64(block_counter),12), "mini_blocks", strconv.FormatInt(int64(mini_block_counter),12), "hash_rate", hash_rate_string, "worker_hashrate", mining_string)
l.SetPrompt(fmt.Sprintf("\033[1m\033[32mDERO Miner: \033[0m"+color+"Height %d "+pcolor+" BLOCKS %d MiniBlocks %d Rejected %d \033[32mNW %s %s>%s>>\033[0m ", our_height, block_counter, mini_block_counter, rejected, hash_rate_string, mining_string, testnet_string))

// MathNodes. Log details to file for minereader
logger.V(0).Info("", "height", strconv.FormatInt(int64(our_height),10), "blocks", strconv.FormatInt(int64(block_counter),12),
"mini_blocks", strconv.FormatInt(int64(mini_block_counter),12), "hash_rate",
hash_rate_string, "worker_hashrate", mining_string)
l.Refresh()
last_our_height = our_height
last_best_height = best_height
}
time.Sleep(60 * time.Second) //changed to log every minute instead of every second (MathNodes)
time.Sleep(60 * time.Second) // Do it every minute instead of every second
}
}()

Expand Down Expand Up @@ -435,7 +438,10 @@ func getwork(wallet_address string) {
}

block_counter = job.Blocks
mini_block_counter = job.MiniBlocks
mini_block_counter = job.MiniBlocks // note if the miner submits the job late, though his counter
// will increase, but a block has been already found, so
// orphan miniblocks may be there ( means they will not br rewarded)
rejected = job.Rejected
hash_rate = job.Difficultyuint64
our_height = int64(job.Height)
Difficulty = job.Difficultyuint64
Expand All @@ -450,6 +456,10 @@ func mineblock(tid int) {
var diff big.Int
var work [block.MINIBLOCK_SIZE]byte

var random_buf [12]byte

rand.Read(random_buf[:])

scratch := astrobwt_fast.Pool.Get().(*astrobwt_fast.ScratchData)

time.Sleep(5 * time.Second)
Expand All @@ -470,11 +480,12 @@ func mineblock(tid int) {

n, err := hex.Decode(work[:], []byte(myjob.Blockhashing_blob))
if err != nil || n != block.MINIBLOCK_SIZE {
logger.Error(err, "Blockwork could not decoded successfully", "blockwork", myjob.Blockhashing_blob, "n", n, "job", myjob)
logger.Error(err, "Blockwork could not be decoded successfully", "blockwork", myjob.Blockhashing_blob, "n", n, "job", myjob)
time.Sleep(time.Second)
continue
}

copy(work[block.MINIBLOCK_SIZE-12:], random_buf[:]) // add more randomization in the mix
work[block.MINIBLOCK_SIZE-1] = byte(tid)

diff.SetString(myjob.Difficulty, 10)
Expand All @@ -492,8 +503,8 @@ func mineblock(tid int) {
powhash := astrobwt_fast.POW_optimized(work[:], scratch)
atomic.AddUint64(&counter, 1)

if CheckPowHashBig(powhash, &diff) == true {
logger.V(1).Info("Successfully found DERO miniblock", "difficulty", myjob.Difficulty, "height", myjob.Height)
if CheckPowHashBig(powhash, &diff) == true { // note we are doing a local, NW might have moved meanwhile
logger.V(1).Info("Successfully found DERO miniblock (going to submit)", "difficulty", myjob.Difficulty, "height", myjob.Height)
func() {
defer globals.Recover(1)
connection_mutex.Lock()
Expand Down

0 comments on commit ee95358

Please sign in to comment.