Make clear that transaction size is measured in virtual bytes

This commit is contained in:
Roman Zeyde 2018-05-16 21:55:29 +03:00
parent 928a6c074f
commit 7bf1c562b2
No known key found for this signature in database
GPG Key ID: 87CAE5FA46917CBB
2 changed files with 6 additions and 6 deletions

View File

@ -37,12 +37,12 @@ pub struct Daemon {
pub struct MempoolEntry {
fee: u64, // in satoshis
size: u32, // in bytes
vsize: u32, // in virtual bytes (= weight/4)
}
impl MempoolEntry {
pub fn fee_per_byte(&self) -> f32 {
self.fee as f32 / self.size as f32
pub fn fee_per_vbyte(&self) -> f32 {
self.fee as f32 / self.vsize as f32
}
}
@ -198,7 +198,7 @@ impl Daemon {
.chain_err(|| "missing base fee")?
.as_f64()
.chain_err(|| "non-float fee")? * 100_000_000f64) as u64,
size: entry
vsize: entry
.get("size")
.chain_err(|| "missing size")?
.as_u64()

View File

@ -49,7 +49,7 @@ impl<'a> Tracker<'a> {
continue;
}
};
debug!("new mempool tx: {}, {:.3}", txid, entry.fee_per_byte());
debug!("new tx: {}, {:.3}", txid, entry.fee_per_vbyte(),);
map_entry.insert(Stats { tx, entry });
}
}