We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The Zcash mainnet and testnet chains encode heights 1 to 16 (inclusive) as individual numeric opcodes (OP_N). These opcodes are encoded as n + 0x50.
n + 0x50
But the spec requires a "1-byte signed little endian" encoding:
Here is the coinbase field of mainnet block 1, showing the OP_1 encoding:
OP_1
{ "hash": "0007bc227e1c57a4a70e237cad00e7b7ce565155ab49166bc57397a26d339283", "height": 1, "tx": [ { "txid": "851bf6fbf7a976327817c738c489d7fa657752445430922d94c983c0b9ed4609", "version": 1, "vin": [ { "coinbase": "5100", } ], }, ], }
(I removed all the irrelevant fields.)
Here is an example of correct deserialization:
// Blocks 1 through 16 inclusive encode block height with OP_N opcodes. (Some(op_n @ 0x51..=0x60), len) if len >= 1 => Height((op_n - 0x50) as u32),
Based on https://github.com/ZcashFoundation/zebra/blob/ebe1c9f88ecc44570ee335c3e8a25bcb53672acd/zebra-chain/src/transparent/serialize.rs#L55-L60
The text was updated successfully, but these errors were encountered:
Thanks, I'll fix it.
Sorry, something went wrong.
9e2938b
No branches or pull requests
The Zcash mainnet and testnet chains encode heights 1 to 16 (inclusive) as individual numeric opcodes (OP_N). These opcodes are encoded as
n + 0x50
.But the spec requires a "1-byte signed little endian" encoding:
Here is the coinbase field of mainnet block 1, showing the
OP_1
encoding:(I removed all the irrelevant fields.)
Here is an example of correct deserialization:
Based on https://github.com/ZcashFoundation/zebra/blob/ebe1c9f88ecc44570ee335c3e8a25bcb53672acd/zebra-chain/src/transparent/serialize.rs#L55-L60
The text was updated successfully, but these errors were encountered: