2014-11-18 15:58:22 +00:00
|
|
|
package types
|
|
|
|
|
2015-03-17 10:19:23 +00:00
|
|
|
import (
|
|
|
|
"math/big"
|
|
|
|
|
|
|
|
"github.com/ethereum/go-ethereum/common"
|
|
|
|
)
|
2014-11-18 15:58:22 +00:00
|
|
|
|
|
|
|
type BlockProcessor interface {
|
2015-02-04 23:05:47 +00:00
|
|
|
Process(*Block) (*big.Int, error)
|
2014-11-18 15:58:22 +00:00
|
|
|
}
|
2015-03-16 16:27:23 +00:00
|
|
|
|
|
|
|
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]
|
|
|
|
}
|
|
|
|
}
|
2015-03-17 10:19:23 +00:00
|
|
|
|
|
|
|
func (b Bloom) Big() *big.Int {
|
|
|
|
return common.Bytes2Big(b[:])
|
|
|
|
}
|