Browse Source

Merge pull request #7 from kevaone/pr-fix

Pr fix
master
The Kevacoin Project 3 years ago committed by GitHub
parent
commit
1fd2611788
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      cnutil/cnutil.go
  2. 1
      cnutil/src/contrib/epee/src/wipeable_string.cpp
  3. 2
      stratum/miner.go
  4. 6
      util/util.go
  5. 11
      www/index.html

2
cnutil/cnutil.go

@ -53,5 +53,5 @@ func Hash(blob []byte, fast bool, height int, seedHash string) []byte {
} }
func FastHash(blob []byte) []byte { func FastHash(blob []byte) []byte {
return Hash(append([]byte{byte(len(blob))}, blob...), true, 0, "") return Hash(blob, true, 0, "")
} }

1
cnutil/src/contrib/epee/src/wipeable_string.cpp

@ -28,6 +28,7 @@
#include <boost/optional/optional.hpp> #include <boost/optional/optional.hpp>
#include <string.h> #include <string.h>
#include <limits>
#include "memwipe.h" #include "memwipe.h"
#include "misc_log_ex.h" #include "misc_log_ex.h"
#include "wipeable_string.h" #include "wipeable_string.h"

2
stratum/miner.go

@ -204,7 +204,7 @@ func (m *Miner) processShare(s *StratumServer, cs *Session, job *Job, t *BlockTe
if len(convertedBlob) == 0 { if len(convertedBlob) == 0 {
convertedBlob = cnutil.ConvertBlob(shareBuff) convertedBlob = cnutil.ConvertBlob(shareBuff)
} }
blockFastHash := hex.EncodeToString(cnutil.FastHash(convertedBlob)) blockFastHash := hex.EncodeToString(util.ReverseBytes(cnutil.FastHash(convertedBlob)))
now := util.MakeTimestamp() now := util.MakeTimestamp()
roundShares := atomic.SwapInt64(&s.roundShares, 0) roundShares := atomic.SwapInt64(&s.roundShares, 0)
ratio := float64(roundShares) / float64(t.diffInt64) ratio := float64(roundShares) / float64(t.diffInt64)

6
util/util.go

@ -29,13 +29,13 @@ func GetTargetHex(diff int64) string {
diffBuff := new(big.Int).Div(Diff1, big.NewInt(diff)).Bytes() diffBuff := new(big.Int).Div(Diff1, big.NewInt(diff)).Bytes()
copy(padded[32-len(diffBuff):], diffBuff) copy(padded[32-len(diffBuff):], diffBuff)
buff := padded[0:4] buff := padded[0:4]
targetHex := hex.EncodeToString(reverse(buff)) targetHex := hex.EncodeToString(ReverseBytes(buff))
return targetHex return targetHex
} }
func GetHashDifficulty(hashBytes []byte) (*big.Int, bool) { func GetHashDifficulty(hashBytes []byte) (*big.Int, bool) {
diff := new(big.Int) diff := new(big.Int)
diff.SetBytes(reverse(hashBytes)) diff.SetBytes(ReverseBytes(hashBytes))
// Check for broken result, empty string or zero hex value // Check for broken result, empty string or zero hex value
if diff.Cmp(new(big.Int)) == 0 { if diff.Cmp(new(big.Int)) == 0 {
@ -75,7 +75,7 @@ func ValidateAddress(addy string, poolAddy string) bool {
return cnutil.ValidateAddress(addy) return cnutil.ValidateAddress(addy)
} }
func reverse(src []byte) []byte { func ReverseBytes(src []byte) []byte {
dst := make([]byte, len(src)) dst := make([]byte, len(src))
for i := len(src); i > 0; i-- { for i := len(src); i > 0; i-- {
dst[len(src)-i] = src[i-1] dst[len(src)-i] = src[i-1]

11
www/index.html

@ -4,7 +4,7 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>MoneroProxy</title> <title>Kevacoin Mining</title>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="//cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.7/spacelab/bootstrap.min.css" rel="stylesheet"> <link href="//cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.7/spacelab/bootstrap.min.css" rel="stylesheet">
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
@ -184,10 +184,10 @@
</tr> </tr>
{{#each blocks}} {{#each blocks}}
<tr> <tr>
<td><a href="https://moneroblocks.info/block/{{height}}" target="_blank">{{formatNumber height}}<a/></td> <td>{{formatNumber height}}</td>
<td>{{formatDate timestamp year="numeric" month="numeric" day="numeric" hour="numeric" minute="numeric"}}</td> <td>{{formatDate timestamp year="numeric" month="numeric" day="numeric" hour="numeric" minute="numeric"}}</td>
<td class="hash"> <td class="hash">
<a href="https://moneroblocks.info/block/{{hash}}" target="_blank">{{hash}}</a> <a href="https://explorer.kevacoin.org/block/{{hash}}" target="_blank">{{hash}}</a>
</td> </td>
<td>{{formatNumber variance style="percent" minimumFractionDigits=2 maximumFractionDigits=2}}</td> <td>{{formatNumber variance style="percent" minimumFractionDigits=2 maximumFractionDigits=2}}</td>
</tr> </tr>
@ -206,7 +206,7 @@
<li role="presentation"><a href="#blocks" id="blocksTab">Blocks</a></li> <li role="presentation"><a href="#blocks" id="blocksTab">Blocks</a></li>
</ul> </ul>
</nav> </nav>
<h3 class="text-muted">MoneroProxy</h3> <h3 class="text-muted">Kevacoin Mining</h3>
</div> </div>
<div id="alert" class="alert alert-danger hide" role="alert"> <div id="alert" class="alert alert-danger hide" role="alert">
<strong>An error occured while polling proxy state.</strong> <strong>An error occured while polling proxy state.</strong>
@ -218,8 +218,7 @@
<footer class="footer"> <footer class="footer">
<div class="container"> <div class="container">
<p> <p>
By <a href="https://github.com/sammy007" target="_blank">sammy007</a>.<br/> Based on <a href="https://github.com/sammy007/monero-stratum" target="_blank">monero-stratum</a> by <a href="https://github.com/sammy007" target="_blank">sammy007</a>.<br/>
<span><strong>XMR</strong>: 47v4BWeUPFrM9YkYRYk2pkS9CubAPEc7BJjNjg4FvF66Y2oVrTAaBjDZhmFzAXgqCNRvBH2gupQ2gNag2FkP983ZMptvUWG</span><br/>
</p> </p>
</div> </div>
</footer> </footer>

Loading…
Cancel
Save