mirror of https://github.com/status-im/nim-eth.git
add 'BloomFilter.init' implementation
This commit is contained in:
parent
0194fb85eb
commit
6c0bc31ad6
|
@ -23,6 +23,9 @@ proc incl*(f: var BloomFilter, h: MDigest[256]) =
|
||||||
for bits in bloomBits(h):
|
for bits in bloomBits(h):
|
||||||
f.value = f.value or bits
|
f.value = f.value or bits
|
||||||
|
|
||||||
|
proc init*(_: type BloomFilter, h: MDigest[256]): BloomFilter =
|
||||||
|
result.incl(h)
|
||||||
|
|
||||||
# TODO: The following 2 procs should be one genric, but it doesn't compile. Nim bug?
|
# TODO: The following 2 procs should be one genric, but it doesn't compile. Nim bug?
|
||||||
proc incl*(f: var BloomFilter, v: string) = f.incl(keccak256.digest(v))
|
proc incl*(f: var BloomFilter, v: string) = f.incl(keccak256.digest(v))
|
||||||
proc incl*(f: var BloomFilter, v: openarray[byte]) = f.incl(keccak256.digest(v))
|
proc incl*(f: var BloomFilter, v: openarray[byte]) = f.incl(keccak256.digest(v))
|
||||||
|
|
Loading…
Reference in New Issue