MCPcopy Create free account
hub / github.com/ElementsProject/elements / __init__

Method __init__

test/functional/test_framework/wallet.py:77–94  ·  view source on GitHub ↗
(self, test_node, *, mode=MiniWalletMode.ADDRESS_OP_TRUE, hrp="ert")

Source from the content-addressed store, hash-verified

75
76class MiniWallet:
77 def __init__(self, test_node, *, mode=MiniWalletMode.ADDRESS_OP_TRUE, hrp="ert"):
78 self._test_node = test_node
79 self._utxos = []
80 self._priv_key = None
81 self._address = None
82
83 assert isinstance(mode, MiniWalletMode)
84 if mode == MiniWalletMode.RAW_OP_TRUE:
85 self._scriptPubKey = bytes(CScript([OP_TRUE]))
86 elif mode == MiniWalletMode.RAW_P2PK:
87 # use simple deterministic private key (k=1)
88 self._priv_key = ECKey()
89 self._priv_key.set((1).to_bytes(32, 'big'), True)
90 pub_key = self._priv_key.get_pubkey()
91 self._scriptPubKey = key_to_p2pk_script(pub_key.get_bytes())
92 elif mode == MiniWalletMode.ADDRESS_OP_TRUE:
93 self._address, self._internal_key = create_deterministic_address_bcrt1_p2tr_op_true(hrp=hrp)
94 self._scriptPubKey = bytes.fromhex(self._test_node.validateaddress(self._address)['scriptPubKey'])
95
96 def rescan_utxos(self):
97 """Drop all utxos and rescan the utxo set"""

Callers

nothing calls this directly

Calls 7

CScriptClass · 0.90
ECKeyClass · 0.90
key_to_p2pk_scriptFunction · 0.90
setMethod · 0.45
get_pubkeyMethod · 0.45
get_bytesMethod · 0.45

Tested by

no test coverage detected