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 219 Lines • ▼ Show 20 Lines | def get_ava_p2p_interface( | ||||
return n | return n | ||||
def gen_proof(node, coinbase_utxos=1): | def gen_proof(node, coinbase_utxos=1): | ||||
blockhashes = node.generate(coinbase_utxos) | blockhashes = node.generate(coinbase_utxos) | ||||
privkey = ECKey() | privkey = ECKey() | ||||
privkey.generate() | privkey.generate() | ||||
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, bytes_to_wif(privkey.get_bytes()), stakes) | ||||
return privkey, FromHex(AvalancheProof(), proof_hex) | return privkey, FromHex(AvalancheProof(), proof_hex) |