Fix sendrawtransaction to return txid string and validate synchronously#35
Conversation
Changes sendrawtransaction RPC handler to return transaction ID as a string instead of ResponseWrapper array. Adds synchronous validation by calling validator service directly before returning, ensuring invalid transactions are rejected immediately per Bitcoin RPC spec.
|
I have two more tests coming momentarily to fix the inadequate coverage. |
|
🤖 Claude Code Review Status: Complete Current Review: The implementation correctly validates transactions synchronously and returns the txid as a string, which fixes the original issues in #33. The approach of calling validator.Validate directly mirrors the propagation service's synchronous path when Kafka is not configured (propagation/Server.go:950). Key observations:
The author noted one concern still needs addressing. Human reviewers should evaluate whether the current approach meets all requirements for transaction propagation in production deployments. |
This updates the RPC service to use the propagation service client directly instead of going through the Distributor, addressing issue bsv-blockchain#33. Changes: - Extract propagation.Client interface for testability - Update RPC Server to accept propagation client - Modify sendrawtransaction handler to use propagation client - Update all RPC tests to work with new propagation client mock This takes direction from issue bsv-blockchain#22 but does not fully implement it yet. Fixes bsv-blockchain#33
…tion The RPC service now creates its own propagation client internally, so it no longer needs txStore and validatorClient passed in from daemon.
|
I have reverted my last commit to this which used the propagation client as it does not support synchronous validation. Instead, I am storing the transaction and then calling the validator. This flow is copied from the non-kafka flow in ProcessTransaction within propagation server. |
|



Summary
Fix sendrawtransaction to return transaction ID as a string and validate synchronously per Bitcoin RPC specification.
Changes
Related Issues
Fixes #33