def test_multisig_spend(): remote = make_client_server() run = asyncio.get_event_loop().run_until_complete M, N = 2, 5 wallet, private_wallets = create_wallet(M, N) index = 0 address = wallet.address_for_index(index) assert address == "89fcf1d21c922b14c1e74dfbbe3a6416b12e26634c708407c1e838221f239cd5" coin = run(coin_for_address(remote, address)) dest_address = wallet.address_for_index(100) pst = spend_coin(wallet, [coin], dest_address) # sign the pst sigs = [] for pw in private_wallets[:M]: sigs.extend(generate_signatures(pst, pw)) spend_bundle, summary_list = finalize_pst(wallet, pst, sigs) r = run(remote.push_tx(tx=spend_bundle)) assert r["response"].startswith("accepted SpendBundle")
def test_multisig_spend(): remote = make_client_server() run = asyncio.get_event_loop().run_until_complete M, N = 2, 5 wallet, private_wallets = create_wallet(M, N) index = 0 address = wallet.address_for_index(index) assert address == "a8f583e8f09c8eeca04c4b62f34734fb3747b021eb41ed05e8265d9dd396cbf6" coin = run(coin_for_address(remote, address)) dest_address = wallet.address_for_index(100) pst = spend_coin(wallet, [coin], dest_address) # sign the pst sigs = [] for pw in private_wallets[:M]: sigs.extend(generate_signatures(pst, pw)) spend_bundle, summary_list = finalize_pst(wallet, pst, sigs) r = run(remote.push_tx(tx=spend_bundle)) assert r["response"].startswith("accepted SpendBundle")
def test_pst_serialization(): run = asyncio.get_event_loop().run_until_complete remote = make_client_server() index = 0 wallet, private_wallets = create_wallet(2, 5) address = wallet.address_for_index(index) coin = run(coin_for_address(remote, address)) dest_address = wallet.address_for_index(10) pst = spend_coin(wallet, [coin], dest_address) # serialize and deserialize the pst pst_blob = bytes(pst) pst_1 = PartiallySignedTransaction.from_bytes(pst_blob) assert pst == pst_1 assert bytes(pst) == bytes(pst_1)