Repository navigation
Add new test mempool accept method - #1212
arminsabouri wants to merge 1 commit into
Conversation
This commits adds a new rpc method (`blockchain.transaction.testmempoolaccept`) which proxies to Bitcoind's [testmempoolaccept](https://developer.bitcoin.org/reference/rpc/testmempoolaccept.html)
kwsantiago
left a comment
There was a problem hiding this comment.
Concept ACK.
Main issue is missing tests for this new RPC method. There should be basic test coverage for valid/invalid transaction scenarios at the minimum.
| .context("failed to broadcast transaction") | ||
| } | ||
|
|
||
| pub(crate) fn test_mempool_accept(&self, tx: &Transaction) -> Result<bool> { |
There was a problem hiding this comment.
Consider returning the full test result instead of just the allowed bool.
| let tx_bytes = Vec::from_hex(tx_hex).context("non-hex transaction")?; | ||
| let tx = deserialize(&tx_bytes).context("invalid transaction")?; | ||
| let accepted = self.daemon.test_mempool_accept(&tx)?; | ||
| Ok(json!(accepted)) |
There was a problem hiding this comment.
May want to add something like:
Ok(json!({"allowed": accepted, "reject_reason": ...}))
Currently clients will get no diagnostic info when a tx is rejected.
| "blockchain.scripthash.subscribe" => Params::ScriptHashSubscribe(convert(params)?), | ||
| "blockchain.scripthash.unsubscribe" => Params::ScriptHashUnsubscribe(convert(params)?), | ||
| "blockchain.transaction.broadcast" => Params::TransactionBroadcast(convert(params)?), | ||
| "blockchain.transaction.testmempoolaccept" => { |
There was a problem hiding this comment.
Does this method name match Electrum protocol spec, or is this a custom extension? May want to document if the latter.
|
Hey @arminsabouri, are you still working on this? If not would it be ok if pushed this forward myself? |
Please feel free to take it over |
This commits adds a new rpc method
(
blockchain.transaction.testmempoolaccept) which proxies to Bitcoin'd testmempoolacceptSeeking a concept Ack/Nack here. My motivation for this PR comes from wanting to use Payjoin on wallets that use electrum as their primary block source. More info here.
Usage example