diff --git a/src/util/bip158.rs b/src/util/bip158.rs index 0ae18091..3be893da 100644 --- a/src/util/bip158.rs +++ b/src/util/bip158.rs @@ -364,9 +364,7 @@ impl<'a> GCSFilterWriter<'a> { mapped.sort_unstable(); // write number of elements as varint - let mut encoder = Vec::new(); - VarInt(mapped.len() as u64).consensus_encode(&mut encoder).expect("in-memory writers don't error"); - let mut wrote = self.writer.write(encoder.as_slice())?; + let mut wrote = VarInt(mapped.len() as u64).consensus_encode(&mut self.writer)?; // write out deltas of sorted values into a Golonb-Rice coded bit stream let mut writer = BitStreamWriter::new(self.writer);