libitx / bsv-ex

Elixir toolset for building Bitcoin applications
https://hexdocs.pm/bsv
Apache License 2.0
28 stars 8 forks source link

Make sure that coinbase transactions are parsed correctly #4

Closed slashrsm closed 4 years ago

slashrsm commented 4 years ago

Currently some coinbase transactions won't parse (Example is 8e77201327 from block #644473).

I suggest to add some logic to differentiate coinbase transactions/inputs/scripts from the rest of them. Approach that is implemented here follows the logic used in moneybutton/bsv - [1], [2].

In the script part I added a new struct element to allow us to differentiate coinbase on that level. Another option would be to store the coinbase data as a single chunk, but in that case it would be harder to detect it. And I figured that being able to do that might be useful.