Skip to content
This repository has been archived by the owner on Oct 20, 2023. It is now read-only.

Commit

Permalink
fixed a duplicate share exploit for bitcoin. (#102)
Browse files Browse the repository at this point in the history
fixed a tiny typo in ethereum_pool.json.
  • Loading branch information
Hüseyin Uslu authored and Oliver Weichhold committed Dec 4, 2017
1 parent b4616aa commit c0eb4da
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/ethereum_pool.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"perPoolLogFile": false
},
"banning": {
"manager": "integrated"
"manager": "integrated",
"banOnJunkReceive": true,
"banOnInvalidShares": false
},
Expand Down
4 changes: 4 additions & 0 deletions src/MiningCore.Tests/Blockchain/Bitcoin/BitcoinJobTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ public void BitcoinJob_Should_Not_Accept_Invalid_Share()
// invalid extra-nonce 2
Assert.Throws<StratumException>(() => job.ProcessShare(worker, "02000000", "59ef86f2", "8d84ae6a"));

// make sure we don't accept case-sensitive duplicate shares as basically 0xdeadbeaf = 0xDEADBEAF.
var share = job.ProcessShare(worker, "01000000", "59ef86f2", "8d84ae6a");
Assert.Throws<StratumException>(() => job.ProcessShare(worker, "01000000", "59ef86f2", "8D84AE6A"));

// invalid time
Assert.Throws<StratumException>(() => job.ProcessShare(worker, "01000000", "69ef86f2", "8d84ae6a"));

Expand Down
4 changes: 2 additions & 2 deletions src/MiningCore/Blockchain/Bitcoin/BitcoinJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,9 @@ protected bool RegisterSubmit(string miner, string worker, string extraNonce1, s
.Append(miner)
.Append(worker)
.Append(extraNonce1)
.Append(extraNonce2)
.Append(extraNonce2.ToLower()) // lowercase as we don't want to accept case-sensitive values as valid.
.Append(nTime)
.Append(nonce)
.Append(nonce.ToLower()) // lowercase as we don't want to accept case-sensitive values as valid.
.ToString();

lock (submissions)
Expand Down

0 comments on commit c0eb4da

Please sign in to comment.