1
0
mirror of https://github.com/romanz/electrs.git synced 2024-11-19 09:54:09 +01:00

Add blockchain.scripthash.unsubscribe

This commit is contained in:
Roman Zeyde 2020-11-09 08:34:47 +02:00
parent c9a97ead37
commit 239900ed30
No known key found for this signature in database
GPG Key ID: 87CAE5FA46917CBB

View File

@ -401,6 +401,14 @@ impl Rpc {
Ok(json!(hash))
}
fn scripthash_unsubscribe(
&self,
subscription: &mut Subscription,
(scripthash,): (ScriptHash,),
) -> Result<Value> {
Ok(json!(subscription.status.remove(&scripthash).is_some()))
}
fn get_confirmed(&self, scripthash: &ScriptHash) -> Result<(Vec<TxEntry>, BlockHash)> {
let result = self
.index
@ -569,6 +577,9 @@ impl Rpc {
"blockchain.scripthash.subscribe" => {
self.scripthash_subscribe(sub, from_value(params)?)
}
"blockchain.scripthash.unsubscribe" => {
self.scripthash_unsubscribe(sub, from_value(params)?)
}
"blockchain.transaction.broadcast" => {
self.transaction_broadcast(from_value(params)?)
}