diff options
Diffstat (limited to 'core/types/common.go')
-rw-r--r-- | core/types/common.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/core/types/common.go b/core/types/common.go index 795374959..dd5dc00c8 100644 --- a/core/types/common.go +++ b/core/types/common.go @@ -5,3 +5,22 @@ import "math/big" type BlockProcessor interface { Process(*Block) (*big.Int, error) } + +type Bloom [256]byte + +func BytesToBloom(b []byte) Bloom { + var bloom Bloom + bloom.SetBytes(b) + return bloom +} + +func (b *Bloom) SetBytes(d []byte) { + if len(b) > len(d) { + panic("bloom bytes too big") + } + + // reverse loop + for i := len(d) - 1; i >= 0; i-- { + b[i] = b[i] + } +} |