Skip to content

Commit

Permalink
None
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Malard committed Jan 29, 2022
1 parent e181e2c commit 05956fb
Show file tree
Hide file tree
Showing 10 changed files with 121 additions and 130 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "babycoin-electrum",
"version": "2.0.3",
"version": "2.0.5",
"daemonVersion": "0.6.1.1",
"description": "GUI interface for BabyCoin Wallet BABY Currency",
"productName": "BabyCoin Electron Wallet",
Expand Down
4 changes: 2 additions & 2 deletions src-electron/main-process/modules/back-up-pool.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ export class Pool {
}

checkHeight() {
let url = "https://explorer.babycoin-network.org/api/networkinfo"
let url = "https://blockchain.babycoin.dev/api/networkinfo"
if(this.testnet) {
url = "https://explorer.babycoin-network.org/api/networkinfo"
url = "https://blockchain.babycoin.dev/api/networkinfo"
}
return request(url)
}
Expand Down
2 changes: 1 addition & 1 deletion src-electron/main-process/modules/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export class Backend {
pool: {
server: {
enabled: true,
bindIP: "0.0.0.0",
bindIP: "127.0.0.1",
bindPort: 3333,
},
mining: {
Expand Down
2 changes: 1 addition & 1 deletion src-electron/main-process/modules/market.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class Market {
this.agent = new https.Agent({ keepAlive: true, maxSockets: 1 })
this.queue = new queue(1, Infinity)
this.options = null
this.endpoint = "/api/v1/get_markets_json.php?market=EVOX/BTC"
this.endpoint = "/api/v1/get_markets_json.php?market=BABY/BTC"
}

start (options) {
Expand Down
4 changes: 2 additions & 2 deletions src-electron/main-process/modules/pool.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,9 @@ export class Pool {
}

checkHeight() {
let url = "http://51.79.65.90:51022/get_info"
let url = "https://blockchain.babycoin.dev/api/networkinfo"
if(this.testnet) {
url = "http://51.79.65.90:51022/get_info"
url = "https://blockchain.babycoin.dev/api/networkinfo"
}
return request(url)
}
Expand Down
39 changes: 19 additions & 20 deletions src-electron/main-process/modules/pool/block.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
import { randomBytes } from "crypto"

export class Block {
constructor(pool, template, uniform=true) {

this.pool = pool
this.template = template
this.uniform = uniform
this.seed_hash = template.seed_hash
this.next_seed_hash = template.next_seed_hash
this.blockhashing_blob = template.blocktemplate_blob
this.extra_nonce = 0
this.height = template.height
this.difficulty = template.difficulty
this.address = pool.config.mining.address
constructor (pool, template, uniform = true) {
this.pool = pool
this.template = template
this.uniform = uniform
this.seed_hash = template.seed_hash
this.next_seed_hash = template.next_seed_hash
this.blockhashing_blob = template.blocktemplate_blob
this.extra_nonce = 0
this.height = template.height
this.difficulty = template.difficulty
this.address = pool.config.mining.address

this.buffer = Buffer.from(template.blocktemplate_blob, "hex")

if(uniform) {
if (uniform) {
/* Uniform mode
* when enabled, we will mimic normal pool
* set extra_nonce to random number between 0-31
Expand All @@ -26,26 +25,26 @@ export class Block {
randomBytes(4).copy(this.buffer, template.reserved_offset + 4)
}
}
newBlob() {
newBlob () {
this.extra_nonce++
if(!this.uniform) {
if (!this.uniform) {
this.extra_nonce = this.extra_nonce % 256
}
this.writeExtraNonce(this.extra_nonce)
return this.convertBlob()
}
convertBlob() {
convertBlob () {
try {
return this.pool.core_bridge.convert_blob(this.buffer.toString("hex"))
} catch(e) {
} catch (e) {
return false
}
}
writeExtraNonce(extra_nonce, buffer=false) {
if(!buffer) {
writeExtraNonce (extra_nonce, buffer = false) {
if (!buffer) {
buffer = this.buffer
}
if(this.uniform) {
if (this.uniform) {
buffer.writeUInt32BE(extra_nonce, this.template.reserved_offset)
} else {
buffer.writeUInt8(extra_nonce % 256, this.template.reserved_offset)
Expand Down
Loading

0 comments on commit 05956fb

Please sign in to comment.