Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pool identification by output address #2

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions addresses.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[
{
"poolName": "yiimp.eu",
"address": "VbnKqcsnXUYn6iPgZc7qb6fXVKd4i3UWM3",
"url": "http://yiimp.eu"
},
{
"poolName": "Suprnova.cc",
"address": "VwDR2x5AZxvKJejtWKiYhrMiZHr5HPVxZv",
"url": "http://vtc.suprnova.cc"
},
{
"poolName": "Zergpool",
"address": "VrdN5UoPynUrtYoqWBXsBhN9Hta2pSZaLL",
"url": "http://zergpool.com"
},
{
"poolName": "HashRefinery",
"address": "VcV8vPAybuTqzZoR9UksM219gRiTHaE3gi",
"url": "http://pool.hashrefinery.com"
},
{
"poolName": "Coinotron",
"address": "VpYQTF5W927YRNxP9osKTTqH3qi8R2r4sB",
"url": "http://coinotron.com"
}
]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't the address field be added to pools.json, to avoid having 2 separate pool lists to maintain?

Also might be worth changing the address field to an array of addresses -- didn't Coinotron used to have a different address? (VuPp8H4W3g1dmwGg6pe41D2Khw8JvfEznn?)

14 changes: 14 additions & 0 deletions lib/blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ var util = require('util');
var vertcore = require('vertcore-lib');
var _ = vertcore.deps._;
var pools = require('../pools.json');
var addresses = require('../addresses.json');
var LRU = require('lru-cache');
var Common = require('./common');
var vcoin = require('vcoin');
Expand Down Expand Up @@ -342,6 +343,15 @@ BlockController.prototype.getPoolInfo = function(tx) {
if (!tx) {
return {};
}

var outputAddress = tx.outputs[0].address;

for(var k in addresses) {
if (outputAddress === addresses[k].address) {
return addresses[k];
}
}

var coinbaseBuffer = tx.inputs[0].script.raw;

for(var k in this.poolStrings) {
Expand All @@ -350,6 +360,10 @@ BlockController.prototype.getPoolInfo = function(tx) {
}
}

if (tx.outputs.length > 1) {
return { "poolName": "P2Pool", "url": "https://vertcoin.org" };

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably correct but IMO doesn't feel right to assume that multiple outputs must be P2Pool. I'm not sure if there's any other way to detect a P2Pool block though (@metalicjames it would be useful if P2Pool would put something in the coinbase like other pools)

It would be nice to be able to configure the pool name & url from pools.json somehow, maybe something like this could work?

{
    "poolName": "P2Pool",
    "url": "https://scanner.vertcoin.org",
    "hasManyOutputs": true
}

}

return {};
};

Expand Down