angepasst
Some checks failed
Build CPU miner / build (push) Has been cancelled

This commit is contained in:
w12
2025-01-07 16:08:56 +01:00
parent 21e65a0727
commit 5231f75240
2 changed files with 32 additions and 35 deletions

View File

@@ -60,13 +60,8 @@ if TARGET_WINDOWS
AM_CPPFLAGS += -DTARGET_WINDOWS AM_CPPFLAGS += -DTARGET_WINDOWS
endif endif
<<<<<<< HEAD
nolambocoin_miner_LDFLAGS = $(PTHREAD_LIBS) nolambocoin_miner_LDFLAGS = $(PTHREAD_LIBS)
nolambocoin_miner_LDADD = @CURL_LIBS@ @JANSSON_LIBS@ $(PTHREAD_LIBS) @WS2_LIBS@ nolambocoin_miner_LDADD = @CURL_LIBS@ @JANSSON_LIBS@ $(PTHREAD_LIBS) @WS2_LIBS@
=======
nolambocoin_miner_LDFLAGS = @PTHREAD_LIBS@
nolambocoin_miner_LDADD = @CURL_LIBS@ @JANSSON_LIBS@ @PTHREAD_LIBS@ @WS2_LIBS@
>>>>>>> b12eeead377cb6dddc74a57b520c4f3334d3e21f
if TARGET_WINDOWS if TARGET_WINDOWS
nolambocoin_miner_LDADD += @WS2_LIBS@ nolambocoin_miner_LDADD += @WS2_LIBS@

View File

@@ -16,52 +16,50 @@
#define BLOCK_VERSION BLOCK_VERSION_DEFAULT #define BLOCK_VERSION BLOCK_VERSION_DEFAULT
#endif #endif
/* Auswahl der Yespower-Parameter basierend auf der Zielplattform */ /* Auswahl der Yespower-Parameter basierend auf nVersion */
const yespower_params_t *select_yespower_params(void) { const yespower_params_t *select_yespower_params_by_version(int32_t nVersion) {
#ifdef TARGET_RASPBERRY_PI if ((nVersion & BLOCK_VERSION_RASPBERRY) == BLOCK_VERSION_RASPBERRY) {
static const yespower_params_t params_rpi = { static const yespower_params_t params_raspberry = {
.version = YESPOWER_1_0, .version = YESPOWER_1_0,
.N = 2048, // Angepasster Wert für bessere Performance .N = 2048,
.r = 8, .r = 8,
.pers = (const uint8_t *)"Raspberry", .pers = (const uint8_t *)"Raspberry",
.perslen = 10 // "Raspberry" hat 10 Zeichen .perslen = 9
}; };
return &params_rpi; return &params_raspberry;
} else if ((nVersion & BLOCK_VERSION_NOARM) == BLOCK_VERSION_NOARM) {
#elif defined(TARGET_NOARM)
static const yespower_params_t params_noarm = { static const yespower_params_t params_noarm = {
.version = YESPOWER_1_0, .version = YESPOWER_1_0,
.N = 4096, .N = 4096,
.r = 16, .r = 16,
.pers = (const uint8_t *)"NoARM", .pers = (const uint8_t *)"NoARM",
.perslen = 5 // "NoARM" hat 5 Zeichen .perslen = 5
}; };
return &params_noarm; return &params_noarm;
} else {
#else
static const yespower_params_t params_default = { static const yespower_params_t params_default = {
.version = YESPOWER_1_0, .version = YESPOWER_1_0,
.N = 4096, .N = 4096,
.r = 16, .r = 16,
.pers = (const uint8_t *)"Default", .pers = (const uint8_t *)"Default",
.perslen = 7 // "Default" hat 7 Zeichen .perslen = 7
}; };
return &params_default; return &params_default;
#endif }
} }
/* Berechnung des Yespower-Hashes */ /* Berechnung des Yespower-Hashes */
int yespower_hash(const char *input, char *output) { int yespower_hash(const char *input, char *output, int32_t nVersion) {
const yespower_params_t *params = select_yespower_params(); const yespower_params_t *params = select_yespower_params_by_version(nVersion);
return yespower_tls((const uint8_t *)input, 80, params, (yespower_binary_t *)output); return yespower_tls((const uint8_t *)input, 80, params, (yespower_binary_t *)output);
} }
/* Scanhash-Funktion für ARM-Architektur mit Yespower */ /* Scanhash-Funktion für ARM-Architektur mit Yespower */
int scanhash_arm_yespower(int thr_id, uint32_t *pdata, const uint32_t *ptarget, uint32_t max_nonce, unsigned long *hashes_done) { int scanhash_arm_yespower(int thr_id, uint32_t *pdata, const uint32_t *ptarget, uint32_t max_nonce, unsigned long *hashes_done, int32_t nVersion) {
const yespower_params_t *params = select_yespower_params(); // Dynamische Parameter-Auswahl const yespower_params_t *params = select_yespower_params_by_version(nVersion);
union { union {
uint8_t u8[80]; // 20 * 4 bytes uint8_t u8[80]; // 80 Bytes Blockheader
uint32_t u32[20]; uint32_t u32[20];
} data; } data;
@@ -70,32 +68,36 @@ int scanhash_arm_yespower(int thr_id, uint32_t *pdata, const uint32_t *ptarget,
uint32_t u32[8]; uint32_t u32[8];
} hash; } hash;
uint32_t n = pdata[19] - 1; uint32_t n = pdata[19] - 1; // Start Nonce
const uint32_t Htarg = ptarget[7]; const uint32_t Htarg = ptarget[7]; // Zielwert (kleiner ist besser)
int i; int i;
// Kodierung der Daten in Big-Endian // Blockdaten in Big-Endian formatieren
for (i = 0; i < 20; i++) for (i = 0; i < 20; i++) {
be32enc(&data.u32[i], pdata[i]); be32enc(&data.u32[i], pdata[i]);
}
do { do {
be32enc(&data.u32[19], ++n); be32enc(&data.u32[19], ++n); // Nonce inkrementieren
if (yespower_tls(data.u8, 80, params, &hash.yb)) if (yespower_tls(data.u8, 80, params, &hash.yb)) {
abort(); abort(); // Fehlerbehandlung
}
// Überprüfung des Hash-Werts
if (le32dec(&hash.u32[7]) <= Htarg) { if (le32dec(&hash.u32[7]) <= Htarg) {
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++) {
hash.u32[i] = le32dec(&hash.u32[i]); hash.u32[i] = le32dec(&hash.u32[i]); // Konvertiere zu Little-Endian
}
if (fulltest(hash.u32, ptarget)) { if (fulltest(hash.u32, ptarget)) {
*hashes_done = n - pdata[19] + 1; *hashes_done = n - pdata[19] + 1;
pdata[19] = n; pdata[19] = n;
return 1; return 1; // Gültiger Block gefunden
} }
} }
} while (n < max_nonce && !work_restart[thr_id].restart); } while (n < max_nonce && !work_restart[thr_id].restart);
*hashes_done = n - pdata[19] + 1; *hashes_done = n - pdata[19] + 1;
pdata[19] = n; pdata[19] = n;
return 0; return 0; // Kein gültiger Block gefunden
} }