zebra/zebrad/src
Janito Vaqueiro Ferreira Filho ba8797e659
Implement `sendrawtransaction` RPC (#3685)
* Stub `sendrawtransaction` RPC method

Register the RPC method, and stub an implementation that currently just
panics. The method has a single `String` parameter with the hexadecimal
string of the raw transaction's bytes and returns a
`SentTransactionHash` wrapper type that's just a hexadecimal `String` of
the sent transaction's hash.

* Add mempool service instance to `RpcImpl`

Use a type parameter to represent the mempool service using the
interface defined by `zebra-node-services`.

* Update test vector to use a mock mempool service

Update the test to be compatible with the changes to `RpcImpl`. The mock
mempool service is expected to not be used during the test.

* Use a `tower::Buffer` for the mempool service

Make it simpler to send requests to the service in a concurrent manner.

* Return a `Future` from `send_raw_transaction`

Make the call asynchronous.

* Implement `sendrawtransaction` RPC

Deserialize the transaction and send it to be queued for verification
and subsequent inclusion in the mempool.

* Test if mempool receives sent raw transaction

Use a mock service as the mempool service and check that it receives a
sent raw transaction.

* Test using non-hexadecimal string parameter

The method should return an error.

* Test with bytes that fail deserialization

Check that the method returns an invalid parameters error if the input
can't be deserialized as a `Transaction`.

* Test if mempool errors are forwarded to caller

Mempool service errors should be sent back to the remote caller as
server errors.

* Test transactions rejected by the mempool service

Transactions that are rejected by the mempool service should result in
a server error being sent to the caller.

* Improve error message

Add the word "structurally" to make it clear that the issue is in the
transaction's deserialization.

Co-authored-by: Deirdre Connolly <durumcrustulum@gmail.com>

* Add note regarding missing `allowhighfees` param.

The parameter isn't supported yet because `lightwalletd` doesn't use it.

* Update the documentation to be consistent

Follow the convention adopted by the `get_info` RPC method.

* Remove mempool service usage line

It contained incomplete information that's not really necessary.

Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>

* Fix formatting

`rustfmt` was not executed on the file for the previous commit because I
had edited it on GitHub.

Co-authored-by: Deirdre Connolly <durumcrustulum@gmail.com>
Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
2022-03-04 03:00:24 -04:00
..
bin/zebrad Consolidate standard lints into a cargo config file (#3386) 2022-01-24 16:25:06 +00:00
commands Implement `sendrawtransaction` RPC (#3685) 2022-03-04 03:00:24 -04:00
components Refactor to create a new `zebra-node-services` crate (#3648) 2022-02-25 21:43:21 +00:00
application.rs Security: When there are no new peers, stop crawler using CPU and writing logs (#3177) 2021-12-10 00:19:52 +00:00
commands.rs Add a copy-state zebrad command, which copies blocks between two state services (#3175) 2021-12-22 02:07:52 +00:00
components.rs Re-order Zebra startup, so slow services are launched last (#3091) 2021-11-23 17:42:44 +00:00
config.rs feature(rpc): add an rpc server to Zebra (#3589) 2022-02-22 08:26:29 -03:00
lib.rs Consolidate standard lints into a cargo config file (#3386) 2022-01-24 16:25:06 +00:00
prelude.rs Fix a deadlock in TokioComponent. 2020-01-15 12:06:31 -08:00
sentry.rs Standardise clippy lints and require docs (#2238) 2021-06-04 08:48:40 +10:00