@pytest.mark.usefixtures('init_blockchain')
def test_get_addresses(rpconn, piece_hashes, spool_regtest, transactions):
    from spool import Spool
    from spool.spoolex import BlockchainSpider
    sender_password = uuid1().hex.encode('utf-8')
    sender_wallet = BIP32Node.from_master_secret(sender_password, netcode='XTN')
    sender_address = sender_wallet.bitcoin_address()
    rpconn.importaddress(sender_address)
    rpconn.sendtoaddress(sender_address, (Spool.FEE / 100000000))
    rpconn.sendtoaddress(sender_address, (Spool.TOKEN / 100000000))
    rpconn.sendtoaddress(sender_address, (Spool.TOKEN / 100000000))
    rpconn.sendtoaddress(sender_address, (Spool.TOKEN / 100000000))
    rpconn.generate(1)
    receiver_address = rpconn.getnewaddress()
    txid = spool_regtest.transfer(('', sender_address), receiver_address, piece_hashes, sender_password, 5, min_confirmations=1)
    decoded_raw_transfer_tx = transactions.get(txid)
    addresses = BlockchainSpider._get_addresses(decoded_raw_transfer_tx)
    assert (len(addresses) == 3)
    assert (addresses[0] == sender_address)
    assert (addresses[1] == receiver_address)
    assert (addresses[2] == piece_hashes[0])
@pytest.mark.usefixtures('init_blockchain')
def test_get_addresses(rpconn, piece_hashes, spool_regtest, transactions):
    from spool import Spool
    from spool.spoolex import BlockchainSpider
    sender_password = uuid1().hex.encode('utf-8')
    sender_wallet = BIP32Node.from_master_secret(sender_password, netcode='XTN')
    sender_address = sender_wallet.bitcoin_address()
    rpconn.importaddress(sender_address)
    rpconn.sendtoaddress(sender_address, (Spool.FEE / 100000000))
    rpconn.sendtoaddress(sender_address, (Spool.TOKEN / 100000000))
    rpconn.sendtoaddress(sender_address, (Spool.TOKEN / 100000000))
    rpconn.sendtoaddress(sender_address, (Spool.TOKEN / 100000000))
    rpconn.generate(1)
    receiver_address = rpconn.getnewaddress()
    txid = spool_regtest.transfer((, sender_address), receiver_address, piece_hashes, sender_password, 5, min_confirmations=1)
    decoded_raw_transfer_tx = transactions.get(txid)
    addresses = BlockchainSpider._get_addresses(decoded_raw_transfer_tx)
    assert (len(addresses) == 3)
    assert (addresses[0] == sender_address)
    assert (addresses[1] == receiver_address)
    assert (addresses[2] == piece_hashes[0])