File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -308,6 +308,16 @@ impl Connection {
308308 Ok ( status_hash)
309309 }
310310
311+ fn blockchain_scripthash_unsubscribe ( & mut self , params : & [ Value ] ) -> Result < Value > {
312+ let script_hash = hash_from_value ( params. first ( ) ) . chain_err ( || "bad script_hash" ) ?;
313+
314+ let removed = self . status_hashes . remove ( & script_hash) . is_some ( ) ;
315+ if removed {
316+ self . stats . subscriptions . dec ( ) ;
317+ }
318+ Ok ( Value :: Bool ( removed) )
319+ }
320+
311321 #[ cfg( not( feature = "liquid" ) ) ]
312322 fn blockchain_scripthash_get_balance ( & self , params : & [ Value ] ) -> Result < Value > {
313323 let script_hash = hash_from_value ( params. first ( ) ) . chain_err ( || "bad script_hash" ) ?;
@@ -446,6 +456,7 @@ impl Connection {
446456 "blockchain.scripthash.get_history" => self . blockchain_scripthash_get_history ( params) ,
447457 "blockchain.scripthash.listunspent" => self . blockchain_scripthash_listunspent ( params) ,
448458 "blockchain.scripthash.subscribe" => self . blockchain_scripthash_subscribe ( params) ,
459+ "blockchain.scripthash.unsubscribe" => self . blockchain_scripthash_unsubscribe ( params) ,
449460 "blockchain.transaction.broadcast" => self . blockchain_transaction_broadcast ( params) ,
450461 "blockchain.transaction.get" => self . blockchain_transaction_get ( params) ,
451462 "blockchain.transaction.get_merkle" => self . blockchain_transaction_get_merkle ( params) ,
You can’t perform that action at this time.
0 commit comments