Repository navigation
fix(firo, insight): index Spark name fee outputs; stock Insight fields and 404s - #37
Merged
Merged
Conversation
Spark name registrations (type 11, from about block 1,300,000) pay the fee to a script that is a P2PKH script followed by OP_SPARKNAMEID <name> OP_DROP <spark address> OP_DROP. firod reports it as sparknamefee with the P2PKH address; the parser derived no address, so these outputs were indexed under the full script and the dev fund aFA2TbqG... missed 163 txs and their utxos. GetAddrDescFromVout now returns the leading 25-byte P2PKH script for exactly firod's CScript::IsSparkNameFee template, so balance, history and utxos merge with plain payments to the address, and the address decoding shows it on the raw, mempool and JSON paths. Any other script is unchanged. Already indexed blocks keep the old descriptor: resync from before the first Spark name fee output.
The Firo extension inserted the newer upstream explorer's synthetic "sparkname" output at n=0 and renumbered the outputs, so tx/:txid vout n was one higher than the on-chain index on Spark name registrations. The deployed stock insight-api-zcoin 0.4.5 does not do that. The output is no longer inserted; sparkData is still added. Exchange outputs get scriptPubKey.type expubkeyhash and Spark name fee outputs pubkeyhash, as stock. A JSON array masternode filter now does what stock's code does with it (the elements joined by a comma as one substring, so usually 200 []) instead of a 400; an array stock throws on, or with non-string elements, is still a 400. The 4 KiB filter cap applies to the joined string.
- utxo rows carry scriptPubKey, the hex output script of the address's index descriptor (no per-output lookup); the listener gets the chain parser for it. - vout scriptPubKey.type is classified from the script with stock's names (pubkeyhash, scripthash, witnesspubkeyhash, witnessscripthash, taproot, plus nulldata and multisig) unless a coin label is set. - status getInfo adds network and testnet from the daemon's chain and relayfee from getnetworkinfo (cached 10 minutes, left out on failure). - With -insightui, unknown paths under /api/ and /insight-api/ are the Insight JSON 404 with CORS headers, as stock, instead of the public server's /api/ status page; /api/v1/ and /api/v2/ still fall through. - The unused empty-script JSON special case for the synthetic sparkname output is removed. spentTxId/spentIndex/spentHeight stay null without Blockbook's extended index (Firo, ZEC); extraPayload/cbTx are not in the index. Both are documented in docs/insight-compatibility.md.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes from the FIRO-02 A/B run of the Insight listener against stock insight-api-zcoin 0.4.5.
Firo
OP_SPARKNAMEID <name> OP_DROP <spark address> OP_DROP. Blockbook couldn't read it, so aFA2TbqG9cnhhzX5Yny2pBJRK5EaEqLCH7 was missing 163 txs (488 FIRO) and a utxo. The parser now indexes these outputs under the P2PKH address descriptor, using the same rule as firod'sIsSparkNameFee. Other scripts are unchanged. Tests use the real script from tx 01676aed….-rollbackonly goes back 300 blocks). A node still below that height only needs the new package.nis the on-chain index.sparkDatais still returned.scriptPubKey.typeisexpubkeyhashfor exchange outputs andpubkeyhashfor Spark name fee outputs.[]), within the existing caps.Insight listener (all coins)
scriptPubKey. It's derived from the address descriptor, so a P2PK output shows its P2PKH script.scriptPubKey.typeis filled in.statusincludesnetwork,testnetandrelayfee(fromgetnetworkinfo, cached)./api/and/insight-api/return the Insight 404 with CORS instead of the-insightuifallback./api/v1/and/api/v2/still reach the explorer.Not included
spentTxId/spentIndex/spentHeightstay null without-extendedindex.extraPayload/cbTxwould need one daemon call per tx.Tests
go test -tags unittest ./bchain/coins/firo/... ./server/...passes in the blockbook-build image, including the Insight tests under-race. gofmt is clean.