MCPcopy Create free account
hub / github.com/ElementsProject/lightning / reverse_bitcoin_hash

Function reverse_bitcoin_hash

tests/test_plugin.py:5004–5010  ·  view source on GitHub ↗

Convert Bitcoin hash between display format and wire format. Bitcoin hashes are stored in reverse byte order in the wire protocol compared to how they're displayed in RPC calls.

(hash_hex)

Source from the content-addressed store, hash-verified

5002
5003
5004def reverse_bitcoin_hash(hash_hex):
5005 """Convert Bitcoin hash between display format and wire format.
5006
5007 Bitcoin hashes are stored in reverse byte order in the wire protocol
5008 compared to how they're displayed in RPC calls.
5009 """
5010 return ''.join(reversed([hash_hex[i:i + 2] for i in range(0, len(hash_hex), 2)]))
5011
5012
5013def test_bwatch_add_watch_creates_datastore_entry(node_factory, bitcoind):

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected