-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Count sigops on electrs side #43
Conversation
Adding a bunch of errors where Also, the prevouts not being the same length and missing prevouts etc. would be caught by the function before it. |
132c81b
to
4a76234
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested ACK @ 4a76234a
Code looks good to me. I agree that the structure is a little odd, but it makes it easy to compare with Core's implementation and confirm that the same logic is reproduced.
There was no measurable performance impact, even on the heavy bulk transaction endpoints.
I cross-tested against the nodejs implementation, and confirmed that the sigop counts were consistent for the ~500k transactions currently in my mempool (except for certain transactions with P2SH multisig inputs, where the error is on the nodejs side 😅).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(reverting my earlier ACK)
Tested NACK @ 4a76234a
It turns out that this actually chokes on coinbase transactions.
87da5d8
to
a03b4f4
Compare
Note: Here are examples of ScriptSigs that fail due to being invalid (But Core still manages to count their sigops.) (From @mononaut) d8828d17a7bdcff5733d7c9c31d8d3bb08bd1ac41e0711d4bf6d47d7542b47cb Seems like the sigop counting pipeline doesn't care if you have a PUSHDATA_47 without 47 bytes to push, it'll just return the sigops. |
a03b4f4
to
761df6c
Compare
Fixed. |
761df6c
to
310b428
Compare
I noticed the recent change removed the need for Result in one of the functions... it propagated outward and changed a bunch of the function signatures. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested reACK @ 310b428
confirmed it handles coinbases that can't be parsed as valid scriptsigs now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested ACK @ [881ca56]
Feature: Count sigops on electrs side
Closes #42
Currently it only returns the sigops count. This new
sigops
value will be returned by the REST for all endpoints, both chain and mempool.Is that enough, or should we also calculate the adjusted VSize and whatnot?
I'm sure it doesn't matter either way, feel free to add whatever you want to the
TransactionValue
struct.