Skip to content
This repository has been archived by the owner on May 23, 2019. It is now read-only.

Commit

Permalink
added payee_amount
Browse files Browse the repository at this point in the history
  • Loading branch information
Evan Duffield committed Oct 6, 2014
1 parent 9e40ed8 commit 27d49a5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 3 additions & 1 deletion lib/block_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,12 @@ def fill_from_rpc(self, data):
payee = None
if(data['payee'] != ''): payee = util.script_to_address(data['payee'])

payee_amount = data.get('payee_amount', data['coinbasevalue']/5) #default to 20%

#txhashes = [None] + [ binascii.unhexlify(t['hash']) for t in data['transactions'] ]
txhashes = [None] + [ util.ser_uint256(int(t['hash'], 16)) for t in data['transactions'] ]
mt = merkletree.MerkleTree(txhashes)
coinbase = CoinbaseTransactionPOW(self.timestamper, self.coinbaser, payee, data['coinbasevalue'],
coinbase = CoinbaseTransactionPOW(self.timestamper, self.coinbaser, payee, payee_amount, data['coinbasevalue'],
data['coinbaseaux']['flags'], data['height'],
settings.COINBASE_EXTRAS)

Expand Down
7 changes: 3 additions & 4 deletions lib/coinbasetx.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class CoinbaseTransactionPOW(halfnode.CTransaction):
extranonce_placeholder = struct.pack(extranonce_type, int('f000000ff111111f', 16))
extranonce_size = struct.calcsize(extranonce_type)

def __init__(self, timestamper, coinbaser, payee, value, flags, height, data):
def __init__(self, timestamper, coinbaser, payee, payee_amount, value, flags, height, data):
super(CoinbaseTransactionPOW, self).__init__()
log.debug("Got to CoinBaseTX")
#self.extranonce = 0
Expand All @@ -37,11 +37,10 @@ def __init__(self, timestamper, coinbaser, payee, value, flags, height, data):

tx_out2 = None
if(payee != None):
value2 = value / 5
value -= value2
value -= payee_amount

tx_out2 = halfnode.CTxOut()
tx_out2.nValue = value2
tx_out2.nValue = payee_amount
tx_out2.scriptPubKey = payee

tx_out = halfnode.CTxOut()
Expand Down

0 comments on commit 27d49a5

Please sign in to comment.