monero-ecosystem / monero-python

A comprehensive Python module for handling Monero cryptocurrency
BSD 3-Clause "New" or "Revised" License
246 stars 80 forks source link

Filter incoming/outgoing payments by tx id #53

Closed arnuschky closed 5 years ago

arnuschky commented 5 years ago

Is it possible to filter the incoming/outgoing payments by tx id? I am surprised that this works only by payment id - most of the time I only have the tx id.

emesik commented 5 years ago

Good idea. The RPC wallet has even a method for it.

arnuschky commented 5 years ago

Temp workaround:

incoming = w.incoming()

def tx_id_in_incoming(incoming, tx_id):
    return len(list(filter(lambda i: i.transaction.hash == tx_id, incoming))) >= 1

Edit: adjusted as you may receive multiple payments within one transaction - thanks @emesik

emesik commented 5 years ago

>= 1 as you may receive multiple payments within one transaction.

emesik commented 5 years ago

Implemented in d44d4fd2ac1422527a7d3e64e09a65741280e57c. Needs docs and will be released in 0.6