Tips are transactions, not addresses
api.getTips()
already returns the tips (= transactions), not addresses.
tips['hashes']
are the transaction hashes of the tips.
So when you do
hashes = api.find_transactions(addresses=addr_tips)
You are giving find_transactions()
a bunch of transaction hashes as addresses. The node then looks up all those transaction hashes (thinking they are addresses because they have the same length as addresses).
Since there are no transactions using those "addresses", you get an empty result.
Bug
You were probably confused because of this. I was too but I figured out that the Addresses
are actually TransactionHashes
because
- Tips are transactions, therefore
get_tips()
should return transactions.
- The result addresses all ended with 4 nines.
TransactionHashes
always end with 4 nines for example:
[Address(b'DGUAYXNWFMZCQOIJBGQGHAUTDZRXOONMIPRHS9KOIGL99OPLAECWGA9MCUAMHFWQJBVJLYGTRRDGA9999'), Address(b'LKNKVDENAJLYPZYEBEEEKGQSGQRHRYZOGZBX9EHGIDLAYPFNXFRPOYXPJKBOMOBPMV9BKDCVKHBPZ9999'), Address(b'VZ9GJYNIYLSNJYFIHCTAFWDCEPYIAOHZPWNUSACVABUDALIJVV9WDEQBFMJEZQHUYCJEFFQNVWKEZ9999'), Address(b'KWAUXSLHYL99HTLOLDXJ9IAMPVEKSJRCTNYUXNIVUZRMEED9PXYKYMICIDTIU9GAUANYMMCHO99MZ9999'), Address(b'TXGGPSGSLEULGFTWEBDNLRBMK9HEXGTVXGSHLXMGSMJGVREYZDFSO9TUDAGOAITAA9NPP9TBELJUA9999'), Address(b'QIUE9NIXHOXWEDZYBKCT9LBPIYVPEJAQIJKYCGPXTICMFIKAXEKRZEJQKSNFEQJZWDLHFDXB9FCJ99999'), Address(b'OGWFDEDC9YQJCJQUSUAGIHUBODOVVCRITJG9RWAFTXHZMTAVJWUPHZWPRWICRIUIKAOMXQWHAKMA99999'), Address(b'MHXVLYBKI9NXVMGASRCSVTGTWPRS9VEN9GAGNFRVOTFHBCXLQUSVDIQHMNHYHZBTZZCSLGHSEDYOA9999'), Address(b'JTG9EEXQFAAI9TGGQ99JA9LMTKWG9FDBOECR9EIAIJEIHGPOEZKSNGDZBPTVEQZKEAPAVVHNMYHBA9999'), ...
Solution
To achieve what you want, this is enough:
tips = api.get_tips()
hashes = tips['hashes']