Fixed retraction bug: inWork() only if not isSearched()
This commit is contained in:
parent
c668dc0c40
commit
821054bf37
27 changed files with 86 additions and 53 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
|
||||||
@
|
@
|
||||||
src/bfclient.cpp,4/6/4680e865da2ad46d274693738207d7b9d80f04ae
|
src/bfclient.cpp,4/6/4680e865da2ad46d274693738207d7b9d80f04ae
|
||||||
|
D
|
||||||
|
src/util/bytestr.cpp,b/8/b817598f47e1a616f47ebab74651021b819feb94
|
||||||
|
L
|
||||||
|
src/bf/libs/ec_pubkey_fast.c,5/9/5995e3430cea453ad68838818ad7fc05c86b119f
|
||||||
|
K
|
||||||
|
src/bf/libs/ripemd160_256.c,4/b/4b8d4ad995cb3950cece8de680eb57ef0fe2921f
|
|
@ -0,0 +1,4 @@
|
||||||
|
|
||||||
|
f
|
||||||
|
squid:S106"9Replace this use of System.out or System.err by a logger.(’Ä¿÷H˜RMAJORZ
|
||||||
|
CODE_SMELL
|
|
@ -0,0 +1,11 @@
|
||||||
|
|
||||||
|
msquid:S2095&"DUse try-with-resources or close this "Socket" in a "finally" clause.(±êÓèHØRBLOCKERZBUG
|
||||||
|
msquid:S2095"DUse try-with-resources or close this "Socket" in a "finally" clause.(ò©·ÙHĘRBLOCKERZBUG
|
||||||
|
f
|
||||||
|
squid:S106 "9Replace this use of System.out or System.err by a logger.(<28>Ï»¸HŘRMAJORZ
|
||||||
|
CODE_SMELL
|
||||||
|
k
|
||||||
|
squid:S1061"9Replace this use of System.out or System.err by a logger.(¨¶ÑÍþÿÿÿÿHƘRMAJORZ
|
||||||
|
CODE_SMELL
|
||||||
|
isquid:S1854("6Remove this useless assignment to local variable "in".(Á±ÅÒúÿÿÿÿHǘRMAJORZ
|
||||||
|
CODE_SMELL
|
5
.sonarlint/modules/client/issues/index.pb
Normal file
5
.sonarlint/modules/client/issues/index.pb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
|
||||||
|
J
|
||||||
|
src/client/CommClient.java,0/7/076b8b4ed34c4da61a1e1eb67e679a86c3a4c0aa
|
||||||
|
L
|
||||||
|
src/client/ClientRunner.java,e/8/e89fbbe78eeb6cfd06a4c707d5f06b23c5422e0e
|
|
@ -1,3 +0,0 @@
|
||||||
|
|
||||||
msquid:S1118":Add a private constructor to hide the implicit public one.(ôÒÿùüÿÿÿÿHÓ•RMAJORZ
|
|
||||||
CODE_SMELL
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
|
||||||
|
ˆsquid:S3776"RRefactor this method to reduce its Cognitive Complexity from 20 to the 15 allowed.(’°ÅýüÿÿÿÿHÓ˜RCRITICALZ
|
||||||
|
CODE_SMELL
|
|
@ -1,23 +0,0 @@
|
||||||
|
|
||||||
Œ
|
|
||||||
squid:S135œ"YReduce the total number of break and continue statements in this loop to use at most one.(ÊÑ€ÄûÿÿÿÿHÈ•RMINORZ
|
|
||||||
CODE_SMELL
|
|
||||||
Œ
|
|
||||||
squid:S135Ä"YReduce the total number of break and continue statements in this loop to use at most one.(ÊÑ€ÄûÿÿÿÿHÉ•RMINORZ
|
|
||||||
CODE_SMELL
|
|
||||||
ˆsquid:S14885"ZImmediately return this expression instead of assigning it to the temporary variable "kr".(·“žÉHÊ•RMINORZ
|
|
||||||
CODE_SMELL
|
|
||||||
wsquid:HiddenFieldChecké"8Rename "root" which hides the field declared at line 20.(Ë·Þ÷ÿÿÿÿÿHË•RMAJORZ
|
|
||||||
CODE_SMELL
|
|
||||||
„squid:S3776<18>"RRefactor this method to reduce its Cognitive Complexity from 21 to the 15 allowed.(¨îïƒHÌ•RCRITICALZ
|
|
||||||
CODE_SMELL
|
|
||||||
’squid:S1149Q"_Replace the synchronized class "StringBuffer" by an unsynchronized one such as "StringBuilder".(¨âà<C3A2>øÿÿÿÿHÍ•RMAJORZ
|
|
||||||
CODE_SMELL
|
|
||||||
Ssquid:S3457#"%String contains no format specifiers.(Ï·Ž®HΕRMAJORZ
|
|
||||||
CODE_SMELL
|
|
||||||
Ssquid:S3457'"%String contains no format specifiers.(<28>¹ÓáHÏ•RMAJORZ
|
|
||||||
CODE_SMELL
|
|
||||||
Ysquid:S3457ê"%String contains no format specifiers.(óŠ¡ËþÿÿÿÿHЕRMAJORZ
|
|
||||||
CODE_SMELL
|
|
||||||
Tsquid:S3457ì"%String contains no format specifiers.(ÐÒ̉HÑ•RMAJORZ
|
|
||||||
CODE_SMELL
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
|
||||||
|
Œ
|
||||||
|
squid:S135Ÿ"YReduce the total number of break and continue statements in this loop to use at most one.(ÊÑ€ÄûÿÿÿÿHî˜RMINORZ
|
||||||
|
CODE_SMELL
|
||||||
|
„squid:S3776‚"RRefactor this method to reduce its Cognitive Complexity from 21 to the 15 allowed.(¨îïƒHï˜RCRITICALZ
|
||||||
|
CODE_SMELL
|
||||||
|
Œ
|
||||||
|
squid:S135Ç"YReduce the total number of break and continue statements in this loop to use at most one.(ÊÑ€ÄûÿÿÿÿHð˜RMINORZ
|
||||||
|
CODE_SMELL
|
||||||
|
ºsquid:S1186¶"€Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation.(ÌÔ’Â8÷Í’ƒ±,Hñ˜RCRITICALZ
|
||||||
|
CODE_SMELL
|
|
@ -1,3 +0,0 @@
|
||||||
|
|
||||||
Œsquid:UselessImportCheck "QRemove this unused import 'org.btcollider.cnc.keysrv.impl.keytree.KeyTreeServer'.(‹Ö†’H¶•RMINORZ
|
|
||||||
CODE_SMELL
|
|
|
@ -1,8 +0,0 @@
|
||||||
|
|
||||||
j"squid:SwitchLastCaseIsDefaultChecky""Add a default case to this switch.(¬ý<C2AC>½HÝ•RCRITICALZ
|
|
||||||
CODE_SMELL
|
|
||||||
Xsquid:S3457."%String contains no format specifiers.(’†þ‡ùÿÿÿÿHß•RMAJORZ
|
|
||||||
CODE_SMELL
|
|
||||||
osquid:S2259y"AA "NullPointerException" could be thrown; "suc" is nullable here.(¬ý<C2AC>½8¤ð’ä°,Hà•RMAJORZBUG
|
|
||||||
ysquid:S1301y"KReplace this "switch" statement by "if" statements to increase readability.(¬ý<C2AC>½HÞ•RMINORZ
|
|
||||||
CODE_SMELL
|
|
|
@ -1,13 +1,15 @@
|
||||||
|
|
||||||
g
|
l
|
||||||
7src/main/java/org/btcollider/cnc/comm/ClientWorker.java,f/b/fb0de740b71d2edb598c4f3deb39da1c59c1ec4f
|
<src/main/java/org/btcollider/cnc/keysrv/keytree/KeyTree.java,3/4/347ab1154aedc2a70c73f64bd3051987dae1332a
|
||||||
|
e
|
||||||
|
5src/main/java/org/btcollider/cnc/comm/CommServer.java,1/1/11f0bf66557a5b2474c03cfac7df8258ad7bfab9
|
||||||
Y
|
Y
|
||||||
)src/main/java/org/btcollider/cnc/CnC.java,e/c/ecc7f16c71ca2f68bf6a65ea47837815c0ff6322
|
)src/main/java/org/btcollider/cnc/CnC.java,e/c/ecc7f16c71ca2f68bf6a65ea47837815c0ff6322
|
||||||
w
|
|
||||||
Gsrc/main/java/org/btcollider/cnc/keysrv/impl/keytree/KeyTreeServer.java,7/c/7c3c3c10537a28026398df21221528f81672fc33
|
|
||||||
f
|
f
|
||||||
6src/main/java/org/btcollider/cnc/keysrv/KSFactory.java,1/3/136c36f2bf1690ff10397e07c3d82baa9b298770
|
6src/main/java/org/btcollider/cnc/keysrv/KeyServer.java,f/4/f451192f21df1ab47fd31c41183e2593ae2a2d27
|
||||||
q
|
r
|
||||||
Asrc/main/java/org/btcollider/cnc/keysrv/impl/keytree/KeyTree.java,b/a/ba1dbf788a980366658d348281a337f09d5317fc
|
Bsrc/main/java/org/btcollider/cnc/keysrv/keytree/KeyTreeServer.java,a/b/ab959dedca57b39487a2217383b67b8e1da032f3
|
||||||
~
|
h
|
||||||
Nsrc/main/java/org/btcollider/cnc/keysrv/impl/multistage/MultiStagedServer.java,3/8/3893e371f649cb23d5f6428b3ca5eeae3bd4979f
|
8src/main/java/org/btcollider/cnc/comm/CommException.java,8/f/8fe1dc8959c76b2c26853ccd55ee1f4bcebcbcfe
|
||||||
|
g
|
||||||
|
7src/main/java/org/btcollider/cnc/comm/ClientWorker.java,f/b/fb0de740b71d2edb598c4f3deb39da1c59c1ec4f
|
|
@ -10,6 +10,7 @@
|
||||||
#include <ec_pubkey_fast.h>
|
#include <ec_pubkey_fast.h>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
#include "bf/Brainflyer.h"
|
#include "bf/Brainflyer.h"
|
||||||
|
@ -17,11 +18,16 @@
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#define BATCH_MAX 4096
|
#define BATCH_MAX 4096
|
||||||
#define WIN_SIZE 16
|
#define WIN_SIZE 21
|
||||||
|
|
||||||
int main() {
|
int main(int argc, char** argv) {
|
||||||
util::bytestr key("db53d9bbd1f3a83b094eeca7dd970bd85b492fa2");
|
util::bytestr key("db53d9bbd1f3a83b094eeca7dd970bd85b492fa2");
|
||||||
|
|
||||||
|
if (argc < 3) {
|
||||||
|
cout << "Invalid argument count" << endl;
|
||||||
|
return (EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
cout << "Initializing precomputation table" << endl;
|
cout << "Initializing precomputation table" << endl;
|
||||||
// init with window size 16, not reading from file
|
// init with window size 16, not reading from file
|
||||||
if (secp256k1_ec_pubkey_precomp_table(WIN_SIZE, nullptr) != 0) {
|
if (secp256k1_ec_pubkey_precomp_table(WIN_SIZE, nullptr) != 0) {
|
||||||
|
@ -37,7 +43,7 @@ int main() {
|
||||||
|
|
||||||
//numThreads = 1;
|
//numThreads = 1;
|
||||||
for (unsigned int i = 0; i < numThreads; i++) {
|
for (unsigned int i = 0; i < numThreads; i++) {
|
||||||
threads[i] = thread{bf::Brainflyer(i, "127.0.0.1", 26765, key)};
|
threads[i] = thread{bf::Brainflyer(i, argv[1], stoi(argv[2]), key)};
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int i = 0; i < numThreads; i++) threads[i].join();
|
for (unsigned int i = 0; i < numThreads; i++) threads[i].join();
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class CnC {
|
||||||
public static final int MAX_BITS = 62;
|
public static final int MAX_BITS = 62;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
KeyServer kts = KSFactory.build(50, 26, 1, TimeUnit.MINUTES, 0.62f);
|
KeyServer kts = KSFactory.build(54, 30, 90, TimeUnit.MINUTES, 0.62f);
|
||||||
CommServer server = new CommServer(PORT, kts);
|
CommServer server = new CommServer(PORT, kts);
|
||||||
try {
|
try {
|
||||||
server.listen();
|
server.listen();
|
||||||
|
|
|
@ -147,7 +147,7 @@ public class ClientWorker implements Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeKey(String key) {
|
private void writeKey(String key) {
|
||||||
try (BufferedWriter writer = new BufferedWriter(new FileWriter("/home/armin/Desktop/cwkey"))) {
|
try (BufferedWriter writer = new BufferedWriter(new FileWriter("~/cwkey"))) {
|
||||||
writer.write(key);
|
writer.write(key);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("Couldn't write key {} to keyfile", key, e);
|
log.error("Couldn't write key {} to keyfile", key, e);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.btcollider.cnc.keysrv;
|
package org.btcollider.cnc.keysrv;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import org.btcollider.cnc.dto.KeyRange;
|
import org.btcollider.cnc.dto.KeyRange;
|
||||||
|
|
||||||
public interface KeyServer {
|
public interface KeyServer {
|
||||||
|
@ -29,4 +30,13 @@ public interface KeyServer {
|
||||||
*/
|
*/
|
||||||
void setSearched(KeyRange keyRange);
|
void setSearched(KeyRange keyRange);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dumps the state of the keys managed by this KeyServer to a file. A KeyServer must be able to
|
||||||
|
* read back the status of its keys from its dump file, but not necessarily from other KeyServers.
|
||||||
|
*
|
||||||
|
* @param file The file to dump the key state to. Path must exist and must be write-able. Not
|
||||||
|
* null.
|
||||||
|
*/
|
||||||
|
void dump(File file);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ public class KeyTree {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean inWork() {
|
public boolean inWork() {
|
||||||
return inWorkSince != -1;
|
return inWorkSince != -1 && !isSearched();
|
||||||
}
|
}
|
||||||
|
|
||||||
public long inWorkSince() {
|
public long inWorkSince() {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.btcollider.cnc.keysrv.keytree;
|
package org.btcollider.cnc.keysrv.keytree;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.BitSet;
|
import java.util.BitSet;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.Queue;
|
import java.util.Queue;
|
||||||
|
@ -304,4 +305,9 @@ public class KeyTreeServer implements KeyServer {
|
||||||
protected KeyTree getKeyTree() {
|
protected KeyTree getKeyTree() {
|
||||||
return this.root;
|
return this.root;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dump(File file) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.btcollider.cnc.keysrv.multistage;
|
package org.btcollider.cnc.keysrv.multistage;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import org.btcollider.cnc.dto.KeyRange;
|
import org.btcollider.cnc.dto.KeyRange;
|
||||||
import org.btcollider.cnc.keysrv.KeyServer;
|
import org.btcollider.cnc.keysrv.KeyServer;
|
||||||
import org.btcollider.cnc.keysrv.keytree.KeyTreeServer;
|
import org.btcollider.cnc.keysrv.keytree.KeyTreeServer;
|
||||||
|
@ -106,4 +107,9 @@ public class MultiStagedServer implements KeyServer {
|
||||||
secKTS.setSearched(secKR);
|
secKTS.setSearched(secKR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dump(File file) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue