mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-17 13:07:54 +02:00
mininode: CTxOut has default asset bitcoin, sets explicit value via int
This commit is contained in:
parent
3c21411c67
commit
92b5911234
2 changed files with 11 additions and 3 deletions
|
|
@ -28,7 +28,7 @@ import asyncore
|
||||||
import time
|
import time
|
||||||
import sys
|
import sys
|
||||||
import random
|
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 io import BytesIO
|
||||||
from codecs import encode
|
from codecs import encode
|
||||||
import hashlib
|
import hashlib
|
||||||
|
|
@ -445,10 +445,14 @@ class CTxOutNonce(object):
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "CTxOutNonce(vchCommitment=%s)" % self.vchCommitment
|
return "CTxOutNonce(vchCommitment=%s)" % self.vchCommitment
|
||||||
|
|
||||||
|
# Asset type defaults to bitcoin
|
||||||
class CTxOut(object):
|
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.nAsset = nAsset
|
||||||
self.nValue = nValue
|
if type(nValue) is int:
|
||||||
|
self.nValue = CTxOutValue(nValue)
|
||||||
|
else:
|
||||||
|
self.nValue = nValue
|
||||||
self.nNonce = nNonce
|
self.nNonce = nNonce
|
||||||
self.scriptPubKey = scriptPubKey
|
self.scriptPubKey = scriptPubKey
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,10 @@ from .authproxy import AuthServiceProxy, JSONRPCException
|
||||||
|
|
||||||
COVERAGE_DIR = None
|
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
|
# The maximum number of nodes a single test can spawn
|
||||||
MAX_NODES = 8
|
MAX_NODES = 8
|
||||||
# Don't assign rpc or p2p ports lower than this
|
# Don't assign rpc or p2p ports lower than this
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue