mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-19 12:51:51 +03:00
bip158: added profiling hints
This commit is contained in:
parent
c3bf4c2770
commit
a703aafad1
@ -1,5 +1,6 @@
|
|||||||
/- bc=bitcoin
|
/- bc=bitcoin
|
||||||
/+ bcu=bitcoin-utils
|
/+ bcu=bitcoin-utils
|
||||||
|
~% %bip-158-top ..part ~
|
||||||
|%
|
|%
|
||||||
++ params
|
++ params
|
||||||
|%
|
|%
|
||||||
@ -8,6 +9,7 @@
|
|||||||
--
|
--
|
||||||
::
|
::
|
||||||
++ siphash
|
++ siphash
|
||||||
|
~/ %siphash
|
||||||
|= [k=byts m=byts]
|
|= [k=byts m=byts]
|
||||||
^- byts
|
^- byts
|
||||||
|^
|
|^
|
||||||
@ -86,6 +88,7 @@
|
|||||||
:: write appends to the back
|
:: write appends to the back
|
||||||
::
|
::
|
||||||
++ str
|
++ str
|
||||||
|
~/ %str
|
||||||
|%
|
|%
|
||||||
++ read-bit
|
++ read-bit
|
||||||
|= s=bits:bc
|
|= s=bits:bc
|
||||||
@ -112,6 +115,7 @@
|
|||||||
:: +gol: Golomb-Rice encoding/decoding
|
:: +gol: Golomb-Rice encoding/decoding
|
||||||
::
|
::
|
||||||
++ gol
|
++ gol
|
||||||
|
~% %gol ..params ~
|
||||||
|%
|
|%
|
||||||
:: +en: encode x and append to end of s
|
:: +en: encode x and append to end of s
|
||||||
:: - s: bits stream
|
:: - s: bits stream
|
||||||
@ -119,6 +123,7 @@
|
|||||||
:: - p: golomb-rice p param
|
:: - p: golomb-rice p param
|
||||||
::
|
::
|
||||||
++ en
|
++ en
|
||||||
|
~/ %en
|
||||||
|= [s=bits:bc x=@ p=@]
|
|= [s=bits:bc x=@ p=@]
|
||||||
^- bits:bc
|
^- bits:bc
|
||||||
=+ q=(rsh [0 p] x)
|
=+ q=(rsh [0 p] x)
|
||||||
@ -128,6 +133,7 @@
|
|||||||
(write-bits:str unary r)
|
(write-bits:str unary r)
|
||||||
::
|
::
|
||||||
++ de
|
++ de
|
||||||
|
~/ %de
|
||||||
|= [s=bits:bc p=@]
|
|= [s=bits:bc p=@]
|
||||||
^- [delta=@ rest=bits:bc]
|
^- [delta=@ rest=bits:bc]
|
||||||
|^ ?> (gth wid.s 0)
|
|^ ?> (gth wid.s 0)
|
||||||
@ -148,6 +154,7 @@
|
|||||||
:: +hsh
|
:: +hsh
|
||||||
::
|
::
|
||||||
++ hsh
|
++ hsh
|
||||||
|
~% %hsh ..params ~
|
||||||
|%
|
|%
|
||||||
:: +to-range
|
:: +to-range
|
||||||
:: - item: scriptpubkey to hash
|
:: - item: scriptpubkey to hash
|
||||||
@ -155,6 +162,7 @@
|
|||||||
:: - k: key for siphash (end of blockhash, reversed)
|
:: - k: key for siphash (end of blockhash, reversed)
|
||||||
::
|
::
|
||||||
++ to-range
|
++ to-range
|
||||||
|
~/ %to-range
|
||||||
|= [item=byts f=@ k=byts]
|
|= [item=byts f=@ k=byts]
|
||||||
^- @
|
^- @
|
||||||
(rsh [0 64] (mul f (swp 3 dat:(siphash k item))))
|
(rsh [0 64] (mul f (swp 3 dat:(siphash k item))))
|
||||||
@ -171,6 +179,7 @@
|
|||||||
--
|
--
|
||||||
::
|
::
|
||||||
++ parse-filter
|
++ parse-filter
|
||||||
|
~/ %parse-filter
|
||||||
|= filter=hexb:bc
|
|= filter=hexb:bc
|
||||||
^- [n=@ux gcs-set=bits:bc]
|
^- [n=@ux gcs-set=bits:bc]
|
||||||
=/ n n:(de:csiz:bcu filter)
|
=/ n n:(de:csiz:bcu filter)
|
||||||
@ -180,6 +189,7 @@
|
|||||||
:: +to-key: blockhash (little endian) to key for siphash
|
:: +to-key: blockhash (little endian) to key for siphash
|
||||||
::
|
::
|
||||||
++ to-key
|
++ to-key
|
||||||
|
~/ %to-key
|
||||||
|= blockhash=tape
|
|= blockhash=tape
|
||||||
^- byts
|
^- byts
|
||||||
%+ take:byt:bcu 16
|
%+ take:byt:bcu 16
|
||||||
@ -191,6 +201,7 @@
|
|||||||
:: - targets: scriptpubkeys to match
|
:: - targets: scriptpubkeys to match
|
||||||
::
|
::
|
||||||
++ match
|
++ match
|
||||||
|
~/ %match
|
||||||
|= [filter=hexb:bc k=byts targets=(list byts)]
|
|= [filter=hexb:bc k=byts targets=(list byts)]
|
||||||
^- ?
|
^- ?
|
||||||
=/ [p=@ m=@] [p:params m:params]
|
=/ [p=@ m=@] [p:params m:params]
|
||||||
@ -214,6 +225,7 @@
|
|||||||
:: - targets: scriptpubkeys to match
|
:: - targets: scriptpubkeys to match
|
||||||
::
|
::
|
||||||
++ all-match
|
++ all-match
|
||||||
|
~/ %all-match
|
||||||
|= [filter=hexb:bc blockhash=hexb:bc targets=(list [address:bc byts])]
|
|= [filter=hexb:bc blockhash=hexb:bc targets=(list [address:bc byts])]
|
||||||
^- (set [address:bc hexb:bc])
|
^- (set [address:bc hexb:bc])
|
||||||
=/ k (to-key (trip (to-cord:hxb:bcu blockhash)))
|
=/ k (to-key (trip (to-cord:hxb:bcu blockhash)))
|
||||||
|
Loading…
Reference in New Issue
Block a user