Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/avatools.py
Show All 26 Lines | |||||
) | ) | ||||
from .p2p import P2PInterface, p2p_lock | from .p2p import P2PInterface, p2p_lock | ||||
from .test_node import TestNode | from .test_node import TestNode | ||||
from .util import ( | from .util import ( | ||||
assert_equal, | assert_equal, | ||||
satoshi_round, | satoshi_round, | ||||
wait_until, | wait_until, | ||||
) | ) | ||||
from .wallet_util import bytes_to_wif | |||||
def create_coinbase_stakes( | def create_coinbase_stakes( | ||||
node: TestNode, | node: TestNode, | ||||
blockhashes: List[str], | blockhashes: List[str], | ||||
priv_key: str, | priv_key: str, | ||||
amount: Optional[str] = None) -> List[Dict[str, Any]]: | amount: Optional[str] = None) -> List[Dict[str, Any]]: | ||||
"""Returns a list of dictionaries representing stakes, in a format | """Returns a list of dictionaries representing stakes, in a format | ||||
▲ Show 20 Lines • Show All 226 Lines • ▼ Show 20 Lines | def gen_proof(node, coinbase_utxos=1): | ||||
privkey.generate() | privkey.generate() | ||||
pubkey = privkey.get_pubkey() | pubkey = privkey.get_pubkey() | ||||
stakes = create_coinbase_stakes( | stakes = create_coinbase_stakes( | ||||
node, blockhashes, node.get_deterministic_priv_key().key) | node, blockhashes, node.get_deterministic_priv_key().key) | ||||
proof_hex = node.buildavalancheproof( | proof_hex = node.buildavalancheproof( | ||||
42, 2000000000, pubkey.get_bytes().hex(), stakes) | 42, 2000000000, pubkey.get_bytes().hex(), stakes) | ||||
return bytes_to_wif(privkey.get_bytes()), FromHex( | return privkey, FromHex(AvalancheProof(), proof_hex) | ||||
AvalancheProof(), proof_hex) |