Function get_status

Source
fn get_status(transactions: Vec<CachedTransaction>) -> Hash
Expand description

As per electrum documentation:

§To calculate the status of a script hash (or address):

  1. order confirmed transactions to the script hash by increasing height (and position in the block if there are more than one in a block)

  2. form a string that is the concatenation of strings “tx_hash:height:” for each transaction in order, where:

tx_hash is the transaction hash in hexadecimal height is the height of the block it is in.

  1. Next, with mempool transactions in any order, append a similar string for those transactions, but where height is -1 if the transaction has at least one unconfirmed input, and 0 if all inputs are confirmed.

  2. The status of the script hash is the sha256() hash of the full string expressed as a hexadecimal string, or null if the string is empty because there are no transactions.