From 68bcd79da59285852e32d4ffcb1b8ff2c27ca2d8 Mon Sep 17 00:00:00 2001
From: AntiochP <30642645+antiochp@users.noreply.github.com>
Date: Thu, 26 Oct 2017 13:41:08 -0400
Subject: [PATCH] height 0 means we have 0 confirmations (cut-through output?)
 (#211)

---
 wallet/src/types.rs | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/wallet/src/types.rs b/wallet/src/types.rs
index 46754e8c2..379df9239 100644
--- a/wallet/src/types.rs
+++ b/wallet/src/types.rs
@@ -189,9 +189,13 @@ impl OutputData {
 	}
 
 	/// 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 {
 		if self.status == OutputStatus::Unconfirmed {
 			0
+		} else if self.status == OutputStatus::Spent && self.height == 0 {
+			0
 		} else {
 			current_height - self.height
 		}