diff --git a/electrum_dash/address_synchronizer.py b/electrum_dash/address_synchronizer.py index 74bd146ca..c78ffe3f3 100644 --- a/electrum_dash/address_synchronizer.py +++ b/electrum_dash/address_synchronizer.py @@ -315,7 +315,7 @@ def add_transaction(self, tx: Transaction, *, allow_unrelated=False) -> bool: # being is_mine, as we roll the gap_limit forward # prevent lelantus transasctions stored as cb. - is_coinbase = tx.inputs()[0].is_coinbase_input() and not tx.inputs()[0].is_lelantus_input() + is_coinbase = tx.inputs()[0].is_coinbase_input() and not (tx.inputs()[0].is_lelantus_input() or tx.inputs()[0].is_spark_input()) tx_height = self.get_tx_height(tx_hash).height if not allow_unrelated: # note that during sync, if the transactions are not properly sorted, diff --git a/electrum_dash/dash_tx.py b/electrum_dash/dash_tx.py index 7d5143e90..fac093a98 100644 --- a/electrum_dash/dash_tx.py +++ b/electrum_dash/dash_tx.py @@ -696,6 +696,26 @@ def read_vds(cls, vds): vds.read_cursor = len(vds.input) return tx +class FiroSparkSpend(ProTxBase): + __slots__ = ('sparkData').split() + + def __str__(self): + res = ('sparkData: %s\n' + % (self.sparkData)) + return res + + def serialize(self): + res = ( + self.sparkData + ) + return res + + @classmethod + def read_vds(cls, vds): + tx = FiroSparkSpend(vds.input[vds.read_cursor:]) + vds.read_cursor = len(vds.input) + return tx + class DashSubTxRegister(ProTxBase): '''Class representing DIP5 SubTxRegister''' @@ -856,6 +876,7 @@ def read_vds(cls, vds): SPEC_PRO_UP_REV_TX = 4 SPEC_CB_TX = 5 LELANTUS_JSPLIT = 8 +SPARK_SPEND = 9 SPEC_TX_HANDLERS = { @@ -865,6 +886,7 @@ def read_vds(cls, vds): SPEC_PRO_UP_REV_TX: DashProUpRevTx, SPEC_CB_TX: DashCbTx, LELANTUS_JSPLIT: FiroLelantusJsplitTx, + SPARK_SPEND: FiroSparkSpend, } @@ -888,7 +910,8 @@ class PSTxTypes(IntEnum): SPEC_PRO_UP_REG_TX: 'ProUpRegTx', SPEC_PRO_UP_REV_TX: 'ProUpRevTx', SPEC_CB_TX: 'CbTx', - LELANTUS_JSPLIT: 'LelantusJsplit' + LELANTUS_JSPLIT: 'LelantusJsplit', + SPARK_SPEND: 'SparkSpend' } diff --git a/electrum_dash/transaction.py b/electrum_dash/transaction.py index a34b08d55..f66994043 100644 --- a/electrum_dash/transaction.py +++ b/electrum_dash/transaction.py @@ -209,6 +209,9 @@ def is_lelantus_input(self) -> bool: return self.script_sig and \ (self.script_sig[0] == 0xC7 or self.script_sig[0] == 0xC9) + def is_spark_input(self) -> bool: + return self.script_sig and self.script_sig[0] == 0xd3 + def is_coinbase_input(self) -> bool: """Whether this is the input of a coinbase tx.""" return self.prevout.is_coinbase()