github gcash/bchd v0.22.4

6 hours ago

This release fetches announced blocks through their headers, as BCHN does, cuts the memory --slpgraphsearch needs to about a fifth, and has the gRPC address calls return the address's number of transactions. Nodes with --addrindex should read the upgrade notes first.

Performance

  • --slpgraphsearch keeps about 210 bytes per SLP transaction instead of the whole transaction (about 1,000 bytes for a typical SEND, more for larger ones), and reads the transactions a search returns from the memory pool or the transaction index.
  • Loading --slpgraphsearch takes about a third less memory at its peak, about 280 MB less per million SLP transactions.

Consensus & Network

  • Catching up with a competing chain that overtakes the node's own no longer takes two minutes per block.
  • Add the chipnet-seed.bchd.cash DNS seed.
  • A peer disconnected just as one of its messages arrived no longer leaves a goroutine behind.
  • A synced node no longer downloads and stores the blocks of lower-work forks that peers announce.
  • A compact block with an invalid header now costs the peer BCHN's ban score, and compact blocks go only to peers known to have the parent's header.

RPC & gRPC

  • gRPC GetAddressTransactions and GetRawAddressTransactions return the address's number of confirmed transactions in confirmed_count.
  • On 32-bit builds, GetAddressTransactions and GetRawAddressTransactions with an nb_skip of 2^31 or more return no confirmed transactions instead of the newest ones.
  • gRPC GetAddressTransactions and GetRawAddressTransactions no longer list a just-confirmed transaction as unconfirmed too.
  • The gRPC SLP calls no longer treat a transaction that left the memory pool unconfirmed as valid after the next block.
  • The gRPC SLP calls no longer treat as valid a transaction that a reorg disconnected and the memory pool didn't take back.
  • GetSlpGraphSearch and the graph search count of GetSlpTrustedValidation answer bad client input with InvalidArgument or NotFound instead of Internal or Aborted.
  • GetSlpGraphSearch and GetSlpTrustedValidation answer a transaction the SLP index does not hold with NotFound, and a failure to read the index with Internal, rather than both with Aborted.
  • GetSlpTrustedValidation answers a query hash of the wrong length with InvalidArgument rather than Aborted.
  • GetSlpTokenMetadata answers a token with no GENESIS or metadata in the SLP index with NotFound, a failure to read the index with Internal, and a token ID of the wrong length with InvalidArgument, instead of Aborted.
  • CheckSlpTransaction and SubmitTransaction answer Internal when the SLP index cannot read an input's entry, rather than taking the input for one without tokens.
  • When the SLP index fails to read a transaction's SLP data, GetTransaction, GetBlock, GetMempool and GetAddressTransactions answer Internal, and the subscriptions send the transaction as UNKNOWN_OR_INVALID, instead of reporting an invalid SLP transaction that burns its inputs.
  • An SLP transaction in the memory pool whose check hits a database failure is checked again at the next block, instead of staying invalid to the SLP calls while it is in the pool.
  • GetUnspentOutput, GetAddressUnspentOutputs and GetTransaction answer Internal when the SLP index fails to read a token or its metadata, rather than leaving it out.
  • GetUnspentOutput returns the SLP token and token metadata of a confirmed output, not only of an unconfirmed one.
  • A memory pool transaction spending an output whose SLP index entry is corrupt is logged as an error, with advice to rebuild the index, and left unjudged instead of judged invalid.
  • An output or transaction whose SLP index entry is corrupt fails the gRPC call with Internal, and streams send it with its SLP state unknown, instead of answering without its token or token metadata.
  • GetUnspentOutput returns an output's SLP token metadata only when include_token_metadata is set, as GetAddressUnspentOutputs does, so clients that read it must now set the flag.
  • GetSlpTokenMetadata no longer reports a mint baton that a block burned while confirming, from the memory pool, the GENESIS or MINT that created it.
  • GetSlpTokenMetadata reports a token's mint baton ended once a MINT ending it is in the memory pool, as it does once the MINT is confirmed, instead of the baton the MINT spent.
  • searchrawtransactions, the websocket address filters and notifyreceived, and the gRPC address calls and transaction filters refuse a legacy address from another network, such as a testnet address on mainnet, instead of reading it as this network's address with the same hash.
  • On systems that don't allow reading the network interfaces, such as Android, bchd creates its RPC certificate without their addresses instead of failing to start.

Database

  • A block spending an output whose SLP index entry is corrupt stops the node with advice to rebuild the index with --dropslpindex, instead of storing the spending transaction as invalid for good.
  • A corrupt SLP token metadata record stops the node with advice to rebuild the index, or fails the gRPC call that reads it, instead of crashing the node.
  • When an index fails on a block, the log names the index instead of reporting a failure to write the chain state.
  • When an index fails to catch up at startup, the error names the index.

Build & Packaging

  • Update dependencies, including gRPC v1.85.0, protobuf v1.36.12, grpc-gateway v2.33.0 and the Prometheus client v1.25.0, and regenerate bchrpc/pb with them.

Other

  • txscript can sign inputs that spend CashTokens, and sign with SIGHASH_UTXOS. SignTxOutputWithSigHashes, SignatureScriptWithSigHashes, RawTxInECDSASignatureWithSigHashes and RawTxInSchnorrSignatureWithSigHashes take the transaction's signature hashes, computed once for all its inputs, which must include the outputs it spends (NewTxSigHashes(tx).WithUtxos(tx, utxos)) for those. The functions without them can't see the spent outputs, so they now return an error for SIGHASH_UTXOS instead of a signature the network refuses.
  • txscript's signing functions return an error, instead of panicking or making an invalid signature, for signature hashes that don't fit the transaction and for SIGHASH_UTXOS with SIGHASH_ANYONECANPAY.
  • txscript's SignTxOutput and SignTxOutputWithSigHashes sign P2SH32 inputs.
  • txscript's SignTxOutput keeps a P2PKH or P2PK signature from previousScript only if it is valid, and no longer returns an invalid script when re-signing one wrapped in P2SH.
  • txscript's CalcSignatureHash returns an error for SIGHASH_UTXOS unless the signature hashes include all the outputs the transaction spends.
  • --slpgraphsearch no longer logs an error for each SLP transaction that arrives while the graph loads.
  • txscript's SignTxOutput drops multisig signatures in previousScript whose hash type the network refuses, and returns an error for a previousScript in Schnorr multisig mode instead of losing its signatures.
  • txscript's signing functions return an error for a hash type the network refuses, such as SigHashOld, instead of a signature it rejects.
  • txscript's SignTxOutput returns an error for a P2SH or P2SH32 input whose redeem script is itself P2SH or P2SH32, instead of an invalid script.

Upgrade notes

  • Address index. On first start, and after an earlier release has run with --addrindex, nodes with it read the address index once to count the transactions of large addresses: under a second on chipnet, a few minutes at most on mainnet.

Don't miss a new bchd release

NewReleases is sending notifications on new releases.