Use a harcoded key to generate filters
Pointed out by alex@. Using a dummy key for now.
This commit is contained in:
parent
dc25da8296
commit
c8627cbee4
1 changed files with 1 additions and 20 deletions
21
server.go
21
server.go
|
@ -771,8 +771,7 @@ func (sp *serverPeer) OnGetCBFilter(_ *peer.Peer, msg *wire.MsgGetCBFilter) {
|
||||||
P := uint8(20) // collision probability
|
P := uint8(20) // collision probability
|
||||||
|
|
||||||
for i := 0; i < gcs.KeySize; i += 4 {
|
for i := 0; i < gcs.KeySize; i += 4 {
|
||||||
binary.BigEndian.PutUint32(key[i:],
|
binary.BigEndian.PutUint32(key[i:], uint32(0xcafebabe))
|
||||||
randomUint32Number(math.MaxUint32))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
filter, err := gcs.BuildGCSFilter(P, key, txHashes)
|
filter, err := gcs.BuildGCSFilter(P, key, txHashes)
|
||||||
|
@ -1013,24 +1012,6 @@ func randomUint16Number(max uint16) uint16 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// randomUint32Number returns a random uint32 in a specified input range. Note
|
|
||||||
// that the range is in zeroth ordering; if you pass it 1800, you will get
|
|
||||||
// values from 0 to 1800.
|
|
||||||
func randomUint32Number(max uint32) uint32 {
|
|
||||||
// In order to avoid modulo bias and ensure every possible outcome in
|
|
||||||
// [0, max) has equal probability, the random number must be sampled
|
|
||||||
// from a random source that has a range limited to a multiple of the
|
|
||||||
// modulus.
|
|
||||||
var randomNumber uint32
|
|
||||||
var limitRange = (math.MaxUint32 / max) * max
|
|
||||||
for {
|
|
||||||
binary.Read(rand.Reader, binary.LittleEndian, &randomNumber)
|
|
||||||
if randomNumber < limitRange {
|
|
||||||
return (randomNumber % max)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// AddRebroadcastInventory adds 'iv' to the list of inventories to be
|
// AddRebroadcastInventory adds 'iv' to the list of inventories to be
|
||||||
// rebroadcasted at random intervals until they show up in a block.
|
// rebroadcasted at random intervals until they show up in a block.
|
||||||
func (s *server) AddRebroadcastInventory(iv *wire.InvVect, data interface{}) {
|
func (s *server) AddRebroadcastInventory(iv *wire.InvVect, data interface{}) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue