From 6876c640cc086300edebdb241b496e23c72ff091 Mon Sep 17 00:00:00 2001 From: Josh Date: Thu, 4 Oct 2018 15:36:43 -0500 Subject: [PATCH] add missing is_generation method on TxInputDcr (#609) --- electrumx/lib/tx.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/electrumx/lib/tx.py b/electrumx/lib/tx.py index a1391c1..0feceb4 100644 --- a/electrumx/lib/tx.py +++ b/electrumx/lib/tx.py @@ -500,6 +500,10 @@ class TxInputDcr(namedtuple("TxInput", "prev_hash prev_idx tree sequence")): return ("Input({}, {:d}, tree={}, sequence={:d})" .format(prev_hash, self.prev_idx, self.tree, self.sequence)) + def is_generation(self): + '''Test if an input is generation/coinbase like''' + return self.prev_idx == MINUS_1 and self.prev_hash == ZERO + class TxOutputDcr(namedtuple("TxOutput", "value version pk_script")): '''Class representing a Decred transaction output.'''