Browse Source

[Test] MiniNode: Implement Zcash coinbase

pull/4/head
Jack Grigg 7 years ago
parent
commit
c10c40779d
No known key found for this signature in database GPG Key ID: 665DBCD284F7DAFF
  1. 14
      qa/rpc-tests/test_framework/blocktools.py

14
qa/rpc-tests/test_framework/blocktools.py

@ -5,7 +5,7 @@
#
from mininode import CBlock, CTransaction, CTxIn, CTxOut, COutPoint
from script import CScript, OP_0
from script import CScript, OP_0, OP_EQUAL, OP_HASH160
# Create a block (with regtest difficulty)
def create_block(hashprev, coinbase, nTime=None, nBits=None):
@ -49,11 +49,21 @@ def create_coinbase(heightAdjust = 0):
CScript([counter+heightAdjust, OP_0]), 0xffffffff))
counter += 1
coinbaseoutput = CTxOut()
coinbaseoutput.nValue = 50*100000000
coinbaseoutput.nValue = int(12.5*100000000)
halvings = int((counter+heightAdjust)/150) # regtest
coinbaseoutput.nValue >>= halvings
coinbaseoutput.scriptPubKey = ""
coinbase.vout = [ coinbaseoutput ]
if halvings == 0: # regtest
froutput = CTxOut()
froutput.nValue = coinbaseoutput.nValue / 5
# regtest
fraddr = bytearray([0x67, 0x08, 0xe6, 0x67, 0x0d, 0xb0, 0xb9, 0x50,
0xda, 0xc6, 0x80, 0x31, 0x02, 0x5c, 0xc5, 0xb6,
0x32, 0x13, 0xa4, 0x91])
froutput.scriptPubKey = CScript([OP_HASH160, fraddr, OP_EQUAL])
coinbaseoutput.nValue -= froutput.nValue
coinbase.vout = [ coinbaseoutput, froutput ]
coinbase.calc_sha256()
return coinbase

Loading…
Cancel
Save