Open ravi-ojha opened 1 year ago
I understand the library tries to get addresses from witness data, and it's certainly possible for it to fail in some cases. As mentioned here.
For those stumbling upon this in future, as that stackexchange answer suggests, it's not recommended to do this. A better (more reliable) way to get addresses of the inputs being spent is to make another RPC call of txid
in vin
and get the outputs of that result. A similar approach is taken by the mempool.space team.
Good point, I will take a look into it.
I've also bumped into this issue while bulk-exporting the blocks into another format.
I get the same error, even with .parse(t, strict=False)
"WARNING:bitcoinlib.scripts:Malformed script, not enough data found"
from https://github.com/1200wd/bitcoinlib/blob/a61f490f5ac4c043af01b502d0df43b2c49af7a9/bitcoinlib/scripts.py#L336
only after it runs for ~24hrs on all incoming transactions! Then it gives me this warning for every 2nd-3rd transaction, but still returns the parsed object! restart my script and works again. Tried on 2 PCs, same thing. Seems like memory/heap issue in the lib.
If this is intended then why does the warning go away after restarting the app? I cannot trust the objects returned when this warning pops up from nowhere.
bitcoinlib==0.6.10 Python 3.9.2 debian
Example snippet:
It logs the error
Malformed script, not enough data found
but returns the Transaction object.This Transaction object has some empty params.
For eg: Notice that the
address
field is empty in theinputs
I tried leaving a comment on my previously closed issue, but no response, so posting as a new issue. Also, noticed the same behavior on blocksmurfer, so I assume this is known?