subscribe_blocks

Function subscribe_blocks 

Source
pub async fn subscribe_blocks(
    drk: &DrkPtr,
    rpc_task: StoppableTaskPtr,
    shell_sender: Sender<Vec<String>>,
    endpoint: Url,
    ex: &ExecutorPtr,
) -> Result<()>
Expand description

Subscribes to darkfid’s JSON-RPC notification endpoint that serves new confirmed blocks. Upon receiving them, all the transactions are scanned and we check if any of them call the money contract, and if the payments are intended for us. If so, we decrypt them and append the metadata to our wallet. If a reorg block is received, we revert to its previous height and then scan it. We assume that the blocks up to that point are unchanged, since darkfid will just broadcast the sequence after the reorg.