mininode: CTxOut has default asset bitcoin, sets explicit value via int

This commit is contained in:
Gregory Sanders 2017-09-20 15:37:30 -04:00
parent 3c21411c67
commit 92b5911234
2 changed files with 11 additions and 3 deletions

View file

@ -28,7 +28,7 @@ import asyncore
import time
import sys
import random
from .util import hex_str_to_bytes, bytes_to_hex_str
from .util import hex_str_to_bytes, bytes_to_hex_str, BITCOIN_ASSET_OUT
from io import BytesIO
from codecs import encode
import hashlib
@ -445,10 +445,14 @@ class CTxOutNonce(object):
def __repr__(self):
return "CTxOutNonce(vchCommitment=%s)" % self.vchCommitment
# Asset type defaults to bitcoin
class CTxOut(object):
def __init__(self, nValue=CTxOutValue(), scriptPubKey=b'', nAsset=CTxOutAsset(), nNonce=CTxOutNonce()):
def __init__(self, nValue=CTxOutValue(), scriptPubKey=b'', nAsset=CTxOutAsset(BITCOIN_ASSET_OUT), nNonce=CTxOutNonce()):
self.nAsset = nAsset
self.nValue = nValue
if type(nValue) is int:
self.nValue = CTxOutValue(nValue)
else:
self.nValue = nValue
self.nNonce = nNonce
self.scriptPubKey = scriptPubKey

View file

@ -28,6 +28,10 @@ from .authproxy import AuthServiceProxy, JSONRPCException
COVERAGE_DIR = None
BITCOIN_ASSET = bytearray.fromhex("b2e15d0d7a0c94e4e2ce0fe6e8691b9e451377f6e46e8045a86f7c4b5d4f0f23")
BITCOIN_ASSET.reverse()
BITCOIN_ASSET_OUT = b"\x01"+BITCOIN_ASSET
# The maximum number of nodes a single test can spawn
MAX_NODES = 8
# Don't assign rpc or p2p ports lower than this