-
Notifications
You must be signed in to change notification settings - Fork 106
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
bug: getrawtransaction
output conflicts with zcashd
output
#8744
Comments
This is also effectively a subset of #8646. |
The fact that zebrad behaves differently than zcashd, but presumably lightwalletd clients do not adapt their behaviour to the backing node type, is further evidence to me that we cannot fix this in a backward-compatible way and shouldn't worry about doing so when changing lightwalletd. |
We're going to wait until we're ready for NU6 testnet activation before prioritising this one |
We also identified that the error codes returned from
Error codes should be drawn from https://github.com/zcash/zcash/blob/master/src/rpc/protocol.h#L32-L80 |
@str4d, since Zebra doesn't keep orphaned blocks below the rollback limit, do you think it'd be OK to return the error "No such mempool or blockchain transaction." in this case? |
What happened?
zcashd
'sgetrawtransaction
API is inherited from Bitcoin Core, and thus its behaviour around general transaction properties (as opposed to Zcash-specific properties) is likely ossified within the wider ecosystem (in particular for exchanges). In particular, the way it sets theconfirmations
field has been that way for many years.In zcash/zcash@f381d4e
zcashd
brought in the Insight Block Explorer patches, which added aheight
field alongside theconfirmations
field. Thus everything I say below about howheight
is set applies equivalently toconfirmations
(just with different values as appropriate).zcashd
'sgetrawtransaction
setsheight
in one of three ways:If the transaction is in the main chain,
height
is set to the height of the block it was mined in.https://github.com/zcash/zcash/blob/0bcddb896c51f58771a20966a0b1f5e5110a7e52/src/main.cpp#L2085-L2088
https://github.com/zcash/zcash/blob/0bcddb896c51f58771a20966a0b1f5e5110a7e52/src/rpc/rawtransaction.cpp#L322-L329
If the transaction is in the mempool,
height
is omitted.https://github.com/zcash/zcash/blob/0bcddb896c51f58771a20966a0b1f5e5110a7e52/src/main.cpp#L2064-L2069
https://github.com/zcash/zcash/blob/0bcddb896c51f58771a20966a0b1f5e5110a7e52/src/rpc/rawtransaction.cpp#L322
If the transaction is not in the mempool and not in the main chain, but is still recognized due to being mined in a block that is currently orphaned (in a non-main chain),
height
is set to -1.https://github.com/zcash/zcash/blob/0bcddb896c51f58771a20966a0b1f5e5110a7e52/src/rpc/rawtransaction.cpp#L332-L335
zebrad
does not implement this API, and instead setsheight
as follows:If the transaction is in the main chain,
height
is set to the height of the block it was mined in.zebra/zebra-rpc/src/methods.rs
Lines 1019 to 1028 in 16168d7
zebra/zebra-rpc/src/methods.rs
Lines 1692 to 1698 in 16168d7
If the transaction is in the mempool,
height
is set to -1.zebra/zebra-rpc/src/methods.rs
Line 1004 in 16168d7
If the transaction is not in the mempool and not in the main chain, but is still recognized due to being mined in a block that is currently orphaned (in a non-main chain),
zebrad
reportsErr("transaction not found")
because non-main chain blocks are not included inzebra_state::ReadResponse::Transaction
.zebra/zebra-rpc/src/methods.rs
Lines 1029 to 1031 in 16168d7
What were you doing when the issue happened?
Debugging
lightwalletd
, which itself is misusing the output ofgetrawtransaction
fromzcashd
: zcash/librustzcash#1473 (comment)Zebra logs
No response
Zebra Version
No response
Which operating systems does the issue happen on?
OS details
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: