Refactor transaction tracking to allow for separate address per invoice and more sane event handling - #43
Conversation
|
@fstromback I'm having trouble retrieving I get this from But I tried to record the binary data we got from Flowee and added it as fixtures for unit tests here. I hope that all the data we want is there, which it should if the docs is correct. You can just do |
|
Sure, I'll have a look! |
|
I just noticed that we do get txid, but only for one of the fixtures... When a tx is seen it's ok: But when it's confirmed, no txid: Weird. And when I look at it, the txid isn't in the fixture... But surely we should get that data from flowee? And another thing: I want to convert txid to strings, something like this: |
|
I think I remember seeing this when implementing the interface, now that you mention it. I need to go and have a closer look at what Flowee does to see if this is the intended behavior, or if we need to tell it that we want txids somehow. Converting them to hex is quite easy, it is just to convert the binary to hex (but reverse the bytes first, I don't know why they differ). I think I have a function for that in the module for bitcoincash addresses. |
Sweet. Now I think the only thing holding this back is the missing txid for the confirmed notification. |
|
I looked at the source code for Flowee to find out what is happening here. Indeed, in the file libs/api/AddressMonitorService.cpp it seems like Flowee does not send the TxId when the transaction has been accepted into a block. Reading the code I also got a bit confused. It seems like it can return multiple "scripthashed" and "amount" tags at the same time. It seems like a single message might contain multiple transactions (contrary to the documentation), but I need to dig deeper to understand this properly. If you have time, try (and capture) the following:
I will try to ask about this. |
|
Reported to Flowee, see here |
|
I got an answer from Tom. It seems Flowee is now sending TxId:s. I have not yet tested, but seems good. Also: I need to re-do some part of that interface, since a transaction may have multiple outputs and we might get multiple outputs from Flowee there. In our case, I think it is just to look for the destination address we are interested in and see if the amount for that one is right. I will look into this. |
|
I saw that. Sounds good. |
Events are now created to communicate between different parts of the system, such as subscribing to a specific address and you'll receive details about a specific transaction. Invoice tracking follow Stripe's invoice workflow: https://stripe.com/docs/invoicing/overview#workflow-overview Also add in fixtures for Flowee, allowing us to test the surrounding logic without requiring an open connection to a running node.
Closes #9, #26, #27