From ff75e91164e898809e3a65eebf9c6918d28c95fd Mon Sep 17 00:00:00 2001 From: xdustinface Date: Thu, 29 Jan 2026 02:27:14 +0100 Subject: [PATCH] fix: add missing transaction types in serialization --- dash/src/blockdata/transaction/mod.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/dash/src/blockdata/transaction/mod.rs b/dash/src/blockdata/transaction/mod.rs index 486a851bc..9da6ee4e4 100644 --- a/dash/src/blockdata/transaction/mod.rs +++ b/dash/src/blockdata/transaction/mod.rs @@ -554,10 +554,20 @@ impl Encodable for Transaction { break; } } - // Forcing have_witness to false for AssetUnlock, as currently Core doesn't support BIP141 SegWit. + // Forcing have_witness to false for special transaction types that legitimately have no inputs. + // Dash Core doesn't support BIP141 SegWit. if self.tx_type() == TransactionType::AssetUnlock { have_witness = false; } + if self.tx_type() == TransactionType::QuorumCommitment { + have_witness = false; + } + if self.tx_type() == TransactionType::MnhfSignal { + have_witness = false; + } + if self.tx_type() == TransactionType::Coinbase { + have_witness = false; + } if !have_witness { len += self.input.consensus_encode(w)?; len += self.output.consensus_encode(w)?; @@ -594,7 +604,8 @@ impl Decodable for Transaction { let input = Vec::::consensus_decode_from_finite_reader(r)?; // segwit let mut segwit = input.is_empty(); - // Forcing segwit to false for AssetUnlock, as currently Core doesn't support BIP141 SegWit. + // Forcing segwit to false for special transaction types that legitimately have no inputs. + // Dash Core doesn't support BIP141 SegWit. if special_transaction_type == TransactionType::AssetUnlock { segwit = false; } @@ -604,6 +615,9 @@ impl Decodable for Transaction { if special_transaction_type == TransactionType::MnhfSignal { segwit = false; } + if special_transaction_type == TransactionType::Coinbase { + segwit = false; + } if segwit { let segwit_flag = u8::consensus_decode_from_finite_reader(r)?; match segwit_flag {