func (d *BoltDB) PutRaw(bucket []byte, key []byte, value fct.IBlock) { var out bytes.Buffer hash := value.GetDBHash() out.Write(hash.Bytes()) data, err := value.MarshalBinary() binary.Write(&out, binary.BigEndian, uint32(len(data))) out.Write(data) if err != nil { panic("This should not happen. Failed to marshal IBlock for BoltDB") } d.db.Update(func(tx *bolt.Tx) error { b := tx.Bucket(bucket) err := b.Put(key, out.Bytes()) return err }) }