mirror of
https://github.com/mimblewimble/grin.git
synced 2025-02-12 22:31:09 +03:00
height 0 means we have 0 confirmations (cut-through output?) (#211)
This commit is contained in:
parent
d7b94a12f5
commit
68bcd79da5
1 changed files with 4 additions and 0 deletions
|
@ -189,9 +189,13 @@ impl OutputData {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// How many confirmations has this output received?
|
/// How many confirmations has this output received?
|
||||||
|
/// If height == 0 then we are either Unconfirmed or the output was cut-through
|
||||||
|
/// so we do not actually know how many confirmations this output had (and never will).
|
||||||
pub fn num_confirmations(&self, current_height: u64) -> u64 {
|
pub fn num_confirmations(&self, current_height: u64) -> u64 {
|
||||||
if self.status == OutputStatus::Unconfirmed {
|
if self.status == OutputStatus::Unconfirmed {
|
||||||
0
|
0
|
||||||
|
} else if self.status == OutputStatus::Spent && self.height == 0 {
|
||||||
|
0
|
||||||
} else {
|
} else {
|
||||||
current_height - self.height
|
current_height - self.height
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue