Skip to content

Commit 09de28c

Browse files
committed
worker diff
change port
1 parent 30cb66c commit 09de28c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+1226
-11401
lines changed

LICENSE

+674
Large diffs are not rendered by default.

Makefile

+6-6
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ dist:
4545

4646
# ===--------------------------------------------------------------------===
4747

48-
${CACHE_ROOT}/virtualenv/virtualenv-1.8.2.tar.gz:
48+
${CACHE_ROOT}/virtualenv/virtualenv-1.10.1.tar.gz:
4949
mkdir -p ${CACHE_ROOT}/virtualenv
50-
sh -c "cd ${CACHE_ROOT}/virtualenv && curl -O http://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.8.2.tar.gz"
50+
sh -c "cd ${CACHE_ROOT}/virtualenv && curl -O https://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.10.1.tar.gz"
5151

52-
${PKG_ROOT}/.stamp-h: conf/requirements*.pip ${CACHE_ROOT}/virtualenv/virtualenv-1.8.2.tar.gz
52+
${PKG_ROOT}/.stamp-h: conf/requirements*.pip ${CACHE_ROOT}/virtualenv/virtualenv-1.10.1.tar.gz
5353
# Because build and run-time dependencies are not thoroughly tracked,
5454
# it is entirely possible that rebuilding the development environment
5555
# on top of an existing one could result in a broken build. For the
@@ -71,14 +71,14 @@ ${PKG_ROOT}/.stamp-h: conf/requirements*.pip ${CACHE_ROOT}/virtualenv/virtualenv
7171
# this project in ``${PKG_ROOT}``.
7272
tar \
7373
-C "${CACHE_ROOT}"/virtualenv --gzip \
74-
-xf "${CACHE_ROOT}"/virtualenv/virtualenv-1.8.2.tar.gz
75-
python "${CACHE_ROOT}"/virtualenv/virtualenv-1.8.2/virtualenv.py \
74+
-xf "${CACHE_ROOT}"/virtualenv/virtualenv-1.10.1.tar.gz
75+
python "${CACHE_ROOT}"/virtualenv/virtualenv-1.10.1/virtualenv.py \
7676
--clear \
7777
--distribute \
7878
--never-download \
7979
--prompt="(p2pool) " \
8080
"${PKG_ROOT}"
81-
-rm -rf "${CACHE_ROOT}"/virtualenv/virtualenv-1.8.2
81+
-rm -rf "${CACHE_ROOT}"/virtualenv/virtualenv-1.10.1
8282

8383
# readline is installed here to get around a bug on Mac OS X which is
8484
# causing readline to not build properly if installed from pip.

Makefile.local

Whitespace-only changes.

README.md

+31-20
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
Requirements:
22
-------------------------
33
Generic:
4-
* Bitcoin >=0.6.4
5-
* Python
6-
* Twisted
7-
* python-argparse (for Python <=2.6)
4+
* Vertcoin >=0.8.5
5+
* Python >=2.6
6+
* Twisted >=10.0.0
7+
* python-argparse (for Python =2.6)
88

99
Linux:
1010
* sudo apt-get install python-zope.interface python-twisted python-twisted-web
11-
* sudo apt-get install python-argparse # if on Python 2.6 or older
11+
* sudo apt-get install python-argparse # if on Python 2.6
1212

1313
Windows:
1414
* Install Python 2.7: http://www.python.org/getit/
@@ -47,16 +47,16 @@ Alternate web front end :
4747
-------------------------
4848
* https://github.com/hardcpp/P2PoolExtendedFrontEnd
4949

50-
Notes for Litecoin:
50+
Notes for Vertcoin:
5151
=========================
5252
Requirements:
5353
-------------------------
54-
In order to run P2Pool with the Litecoin network, you would need to build and install the
55-
ltc_scrypt module that includes the scrypt proof of work code that Litecoin uses for hashes.
54+
In order to run P2Pool with the Vertcoin network, you would need to build and install the
55+
vtc_scrypt module that includes the scrypt proof of work code that Vertcoin uses for hashes.
5656

5757
Linux:
5858

59-
cd litecoin_scrypt
59+
cd py_modules/vertcoin_scrypt
6060
sudo python setup.py install
6161

6262
Windows (mingw):
@@ -65,7 +65,7 @@ Windows (mingw):
6565

6666
In bash type this:
6767

68-
cd litecoin_scrypt
68+
cd py_modules\vertcoin_scrypt
6969
C:\Python27\python.exe setup.py build --compile=mingw32 install
7070

7171
Windows (microsoft visual c++)
@@ -75,21 +75,32 @@ In bash type this:
7575

7676
SET VS90COMNTOOLS=%VS110COMNTOOLS% # For visual c++ 2012
7777
SET VS90COMNTOOLS=%VS100COMNTOOLS% # For visual c++ 2010
78-
cd litecoin_scrypt
78+
cd py_modules\vertcoin_scrypt
7979
C:\Python27\python.exe setup.py build --compile=mingw32 install
80-
80+
8181
If you run into an error with unrecognized command line option '-mno-cygwin', see this:
8282
http://stackoverflow.com/questions/6034390/compiling-with-cython-and-mingw-produces-gcc-error-unrecognized-command-line-o
8383

8484
Running P2Pool:
8585
-------------------------
86-
Run P2Pool with the "--net litecoin" option.
87-
Run your miner program, connecting to 127.0.0.1 on port 9327.
88-
Forward port 9338 to the host running P2Pool.
86+
Run P2Pool with the "--net vertcoin" option.
87+
Run your miner program, connecting to 127.0.0.1 on port 9171.
88+
89+
Notes for Cachecoin:
90+
=========================
91+
This is currently under heavy development and still experimental. For the
92+
current latest stable implementation, please use https://github.com/Sykh/p2pool-cache
93+
94+
Sponsors:
95+
-------------------------
96+
97+
Thanks to:
98+
* The Bitcoin Foundation for its generous support of P2Pool
99+
* The Litecoin Project for its generous donations to P2Pool
100+
* The Vertcoin Community for its great contribution to P2Pool
101+
89102

90-
Litecoin's use of ports 9332 and 9332 conflicts with P2Pool running on
91-
the Bitcoin network. To avoid problems, add these lines to litecoin.conf
92-
and restart litecoind:
93103

94-
rpcport=10332
95-
port=10333
104+
##### PORT CHANGE
105+
# nat
106+
# -A PREROUTING -i eth0 -p tcp --dport 6903 -j REDIRECT --to-port 7903

SOAPpy/Parser.py

+2
Original file line numberDiff line numberDiff line change
@@ -1050,6 +1050,8 @@ def _parseSOAP(xml_str, rules = None):
10501050
# turn on namespace mangeling
10511051
parser.setFeature(xml.sax.handler.feature_namespaces,1)
10521052

1053+
parser.setFeature(xml.sax.handler.feature_external_ges, 0)
1054+
10531055
try:
10541056
parser.parse(inpsrc)
10551057
except xml.sax.SAXParseException, e:

conf/requirements.production.pip

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
Twisted>=12.2.0
22
argparse>=1.2.1
3+
pyOpenSSL>=0.13

nattraverso/__init__.pyc

-6 Bytes
Binary file not shown.

nattraverso/ipdiscover.pyc

-42 Bytes
Binary file not shown.

nattraverso/portmapper.pyc

-54 Bytes
Binary file not shown.

nattraverso/utils.pyc

-24 Bytes
Binary file not shown.

p2pool/__init__.pyc

-1.79 KB
Binary file not shown.

p2pool/bitcoin/__init__.pyc

-134 Bytes
Binary file not shown.

p2pool/bitcoin/data.py

-20
Original file line numberDiff line numberDiff line change
@@ -226,26 +226,11 @@ def average_attempts_to_target(average_attempts):
226226
def target_to_difficulty(target):
227227
assert 0 <= target and isinstance(target, (int, long)), target
228228
if target >= 2**256: warnings.warn('target >= 2**256!')
229-
###Neisklar: Quarkcoins diff is 1 Byte off (256 times off), who the heck had that idea...
230-
#return (0xffff0000 * 2**(256-56) + 1)/(target + 1)
231-
232-
### Neisklar: this was a very bad idea, we need to keep the standard diff calculations for all the other
233-
### stuff out there. If we would change this, then we would NEED to change the miner, and since the miner is
234-
### already out there in the wild, this won't work.
235-
### The actual problem is stratum: stratum sends NOT the target, it sends the diff and then the client creates from that diff
236-
### locally the target, which means the client must know about that 1 Byte shift, which it doesn't.
237-
### So we stick to the bitcoin definition of a diff 1 target.
238-
### We just need to change the display in the p2pools log and statspage, to handle that offset.
239-
###
240-
### And the diff display in the Quarkcoin wallet should be adjusted.
241229
return (0xffff0000 * 2**(256-64) + 1)/(target + 1)
242230

243231
def difficulty_to_target(difficulty):
244232
assert difficulty >= 0
245233
if difficulty == 0: return 2**256-1
246-
#return min(int((0xffff0000 * 2**(256-56) + 1)/difficulty - 1 + 0.5), 2**256-1)
247-
248-
### Neisklar: see above
249234
return min(int((0xffff0000 * 2**(256-64) + 1)/difficulty - 1 + 0.5), 2**256-1)
250235

251236
# human addresses
@@ -276,11 +261,6 @@ def address_to_pubkey_hash(address, net):
276261
if x['version'] != net.ADDRESS_VERSION:
277262
raise ValueError('address not for this net!')
278263
return x['pubkey_hash']
279-
def address_to_pubkey_hash_version(address, version):
280-
x = human_address_type.unpack(base58_decode(address))
281-
if x['version'] != version:
282-
raise ValueError('address not for this net!')
283-
return x['pubkey_hash']
284264

285265
# transactions
286266

p2pool/bitcoin/data.pyc

-14.3 KB
Binary file not shown.

p2pool/bitcoin/getwork.pyc

-4.26 KB
Binary file not shown.

p2pool/bitcoin/height_tracker.pyc

-5.71 KB
Binary file not shown.

p2pool/bitcoin/helper.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
@defer.inlineCallbacks
1212
def check(bitcoind, net):
1313
if not (yield net.PARENT.RPC_CHECK(bitcoind)):
14-
print >>sys.stderr, " Check failed! Make sure that you're connected to the right Client with --bitcoind-rpc-port!"
14+
print >>sys.stderr, " Check failed! Make sure that you're connected to the right bitcoind with --bitcoind-rpc-port!"
1515
raise deferral.RetrySilentlyException()
1616
if not net.VERSION_CHECK((yield bitcoind.rpc_getinfo())['version']):
17-
print >>sys.stderr, ' Client version too old! Upgrade to newer!'
17+
print >>sys.stderr, ' Bitcoin version too old! Upgrade to 0.6.4 or newer!'
1818
raise deferral.RetrySilentlyException()
1919

2020
@deferral.retry('Error getting work from bitcoind:', 3)
@@ -36,7 +36,7 @@ def go():
3636
work = yield go()
3737
end = time.time()
3838
except jsonrpc.Error_for_code(-32601): # Method not found
39-
print >>sys.stderr, 'Error: Client version too old! Upgrade to v0.5 or newer!'
39+
print >>sys.stderr, 'Error: Bitcoin version too old! Upgrade to v0.5 or newer!'
4040
raise deferral.RetrySilentlyException()
4141
packed_transactions = [(x['data'] if isinstance(x, dict) else x).decode('hex') for x in work['transactions']]
4242
if 'height' not in work:

p2pool/bitcoin/helper.pyc

-4.87 KB
Binary file not shown.

p2pool/bitcoin/networks.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,18 @@
44
from twisted.internet import defer
55

66
from . import data
7-
from p2pool.util import math, pack
7+
from p2pool.util import math, pack, jsonrpc
8+
from operator import *
9+
10+
11+
@defer.inlineCallbacks
12+
def check_genesis_block(bitcoind, genesis_block_hash):
13+
try:
14+
yield bitcoind.rpc_getblock(genesis_block_hash)
15+
except jsonrpc.Error_for_code(-5):
16+
defer.returnValue(False)
17+
else:
18+
defer.returnValue(True)
819

920
nets = dict(
1021

@@ -30,6 +41,7 @@
3041
DUMB_SCRYPT_DIFF=1,
3142
DUST_THRESHOLD=0.001e8,
3243
),
44+
3345
)
3446
for net_name, net in nets.iteritems():
3547
net.NAME = net_name

p2pool/bitcoin/networks.pyc

-2.58 KB
Binary file not shown.

p2pool/bitcoin/p2p.py

+23-22
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Protocol(p2protocol.Protocol):
1616
def __init__(self, net):
1717
p2protocol.Protocol.__init__(self, net.P2P_PREFIX, 1000000, ignore_trailing_payload=True)
1818
self.net = net
19-
19+
2020
def connectionMade(self):
2121
self.send_version(
2222
version=70002,
@@ -36,7 +36,7 @@ def connectionMade(self):
3636
sub_version_num='/P2Pool:%s/' % (p2pool.__version__,),
3737
start_height=0,
3838
)
39-
39+
4040
message_version = pack.ComposedType([
4141
('version', pack.IntType(32)),
4242
('services', pack.IntType(64)),
@@ -49,21 +49,20 @@ def connectionMade(self):
4949
])
5050
def handle_version(self, version, services, time, addr_to, addr_from, nonce, sub_version_num, start_height):
5151
self.send_verack()
52-
52+
5353
message_verack = pack.ComposedType([])
5454
def handle_verack(self):
5555
self.get_block = deferral.ReplyMatcher(lambda hash: self.send_getdata(requests=[dict(type='block', hash=hash)]))
5656
self.get_block_header = deferral.ReplyMatcher(lambda hash: self.send_getheaders(version=1, have=[], last=hash))
57-
57+
5858
if hasattr(self.factory, 'resetDelay'):
5959
self.factory.resetDelay()
6060
if hasattr(self.factory, 'gotConnection'):
6161
self.factory.gotConnection(self)
62-
63-
#self.pinger = deferral.RobustLoopingCall(self.send_ping)
62+
6463
self.pinger = deferral.RobustLoopingCall(self.send_ping, nonce=1234)
6564
self.pinger.start(30)
66-
65+
6766
message_inv = pack.ComposedType([
6867
('invs', pack.ListType(pack.ComposedType([
6968
('type', pack.EnumType(pack.IntType(32), {1: 'tx', 2: 'block'})),
@@ -78,7 +77,7 @@ def handle_inv(self, invs):
7877
self.factory.new_block.happened(inv['hash'])
7978
else:
8079
print 'Unknown inv type', inv
81-
80+
8281
message_getdata = pack.ComposedType([
8382
('requests', pack.ListType(pack.ComposedType([
8483
('type', pack.EnumType(pack.IntType(32), {1: 'tx', 2: 'block'})),
@@ -96,7 +95,7 @@ def handle_inv(self, invs):
9695
('last', pack.PossiblyNoneType(0, pack.IntType(256))),
9796
])
9897
message_getaddr = pack.ComposedType([])
99-
98+
10099
message_addr = pack.ComposedType([
101100
('addrs', pack.ListType(pack.ComposedType([
102101
('timestamp', pack.IntType(32)),
@@ -106,32 +105,34 @@ def handle_inv(self, invs):
106105
def handle_addr(self, addrs):
107106
for addr in addrs:
108107
pass
109-
108+
110109
message_tx = pack.ComposedType([
111110
('tx', bitcoin_data.tx_type),
112111
])
113112
def handle_tx(self, tx):
114113
self.factory.new_tx.happened(tx)
115-
114+
116115
message_block = pack.ComposedType([
117116
('block', bitcoin_data.block_type),
118117
])
119118
def handle_block(self, block):
119+
#block_hash = bitcoin_data.hash256(bitcoin_data.block_header_type.pack(block['header']))
120120
block_hash = self.net.BLOCKHASH_FUNC(bitcoin_data.block_header_type.pack(block['header']))
121121
self.get_block.got_response(block_hash, block)
122122
self.get_block_header.got_response(block_hash, block['header'])
123-
123+
124124
message_headers = pack.ComposedType([
125125
('headers', pack.ListType(bitcoin_data.block_type)),
126126
])
127127
def handle_headers(self, headers):
128128
for header in headers:
129129
header = header['header']
130-
131130
header_hash = self.net.BLOCKHASH_FUNC(bitcoin_data.block_header_type.pack(header))
132131
self.get_block_header.got_response(header_hash, header)
132+
133+
#self.get_block_header.got_response(bitcoin_data.hash256(bitcoin_data.block_header_type.pack(header)), header)
133134
self.factory.new_headers.happened([header['header'] for header in headers])
134-
135+
135136
message_ping = pack.ComposedType([
136137
('nonce', pack.IntType(64)),
137138
])
@@ -143,14 +144,14 @@ def handle_ping(self, nonce):
143144
])
144145
def handle_pong(self, nonce):
145146
pass
146-
147+
147148
message_alert = pack.ComposedType([
148149
('message', pack.VarStrType()),
149150
('signature', pack.VarStrType()),
150151
])
151152
def handle_alert(self, message, signature):
152153
pass # print 'ALERT:', (message, signature)
153-
154+
154155
def connectionLost(self, reason):
155156
if hasattr(self.factory, 'gotConnection'):
156157
self.factory.gotConnection(None)
@@ -161,24 +162,24 @@ def connectionLost(self, reason):
161162

162163
class ClientFactory(protocol.ReconnectingClientFactory):
163164
protocol = Protocol
164-
165+
165166
maxDelay = 1
166-
167+
167168
def __init__(self, net):
168169
self.net = net
169170
self.conn = variable.Variable(None)
170-
171+
171172
self.new_block = variable.Event()
172173
self.new_tx = variable.Event()
173174
self.new_headers = variable.Event()
174-
175+
175176
def buildProtocol(self, addr):
176177
p = self.protocol(self.net)
177178
p.factory = self
178179
return p
179-
180+
180181
def gotConnection(self, conn):
181182
self.conn.set(conn)
182-
183+
183184
def getProtocol(self):
184185
return self.conn.get_not_none()

p2pool/bitcoin/p2p.pyc

-7.74 KB
Binary file not shown.

p2pool/bitcoin/script.pyc

-4 KB
Binary file not shown.

p2pool/bitcoin/sha256.pyc

-4.06 KB
Binary file not shown.

p2pool/bitcoin/stratum.pyc

-5.21 KB
Binary file not shown.

p2pool/bitcoin/worker_interface.pyc

-6.96 KB
Binary file not shown.

0 commit comments

Comments
 (0)