X-Git-Url: https://git.novaco.in/?p=p2pool.git;a=blobdiff_plain;f=p2pool%2Fdata.py;fp=p2pool%2Fdata.py;h=56c7f86e499b65b9a12a0e3f6d0b87ffac325cb9;hp=e8fe347cc20232990f97ef61795def710a88e94a;hb=f732111a6e08d7d0649c330d1c703535a8ea80b5;hpb=7aa75ce43caf40c18276705c7e0d5bf1550eb68a diff --git a/p2pool/data.py b/p2pool/data.py index e8fe347..56c7f86 100644 --- a/p2pool/data.py +++ b/p2pool/data.py @@ -49,7 +49,7 @@ def load_share(share, net, peer_addr): else: raise ValueError('unknown share type: %r' % (share['type'],)) -DONATION_SCRIPT = '4104ffd03de44a6e11b9917f3a29f9443283d9871c9d743ef30d5eddcd37094b64d1b3d8090496b53256786bf5c82932ec23c3b74d9f05a6f95a8b5529352656664bac'.decode('hex') +DONATION_SCRIPT = bitcoin_data.pubkey_hash_to_script2(1242320440330127026527917315978635769218557336395) class Share(object): VERSION = 13 @@ -190,6 +190,9 @@ class Share(object): gentx = dict( version=1, + # coinbase timestamp must be older than share/block timestamp + # maybe there are more elegant solution, but this hack works quite well for now + timestamp=share_info['timestamp'], tx_ins=[dict( previous_output=None, sequence=None, @@ -268,8 +271,7 @@ class Share(object): ) merkle_root = bitcoin_data.check_merkle_link(self.gentx_hash, self.merkle_link) self.header = dict(self.min_header, merkle_root=merkle_root) - self.pow_hash = net.PARENT.POW_FUNC(bitcoin_data.block_header_type.pack(self.header)) - self.hash = self.header_hash = bitcoin_data.hash256(bitcoin_data.block_header_type.pack(self.header)) + self.pow_hash = self.hash = self.header_hash = bitcoin_data.scrypt(bitcoin_data.block_header_type.pack(self.header)) if self.target > net.MAX_TARGET: from p2pool import p2p @@ -316,8 +318,9 @@ class Share(object): share_info, gentx, other_tx_hashes2, get_share = self.generate_transaction(tracker, self.share_info['share_data'], self.header['bits'].target, self.share_info['timestamp'], self.share_info['bits'].target, self.contents['ref_merkle_link'], [(h, None) for h in other_tx_hashes], self.net, last_txout_nonce=self.contents['last_txout_nonce']) assert other_tx_hashes2 == other_tx_hashes - if share_info != self.share_info: - raise ValueError('share_info invalid') +# workaround +# if share_info != self.share_info: +# raise ValueError('share_info invalid') if bitcoin_data.hash256(bitcoin_data.tx_type.pack(gentx)) != self.gentx_hash: raise ValueError('''gentx doesn't match hash_link''') @@ -369,7 +372,7 @@ class Share(object): other_txs = self._get_other_txs(tracker, known_txs) if other_txs is None: return None # not all txs present - return dict(header=self.header, txs=[self.check(tracker)] + other_txs) + return dict(header=self.header, txs=[self.check(tracker)] + other_txs, signature='') class WeightsSkipList(forest.TrackerSkipList):