Skip to content

Commit 3f8fee4

Browse files
authored
fix: add missing transaction types in serialization (#401)
1 parent 7cc3b05 commit 3f8fee4

File tree

1 file changed

+16
-2
lines changed
  • dash/src/blockdata/transaction

1 file changed

+16
-2
lines changed

dash/src/blockdata/transaction/mod.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,10 +554,20 @@ impl Encodable for Transaction {
554554
break;
555555
}
556556
}
557-
// Forcing have_witness to false for AssetUnlock, as currently Core doesn't support BIP141 SegWit.
557+
// Forcing have_witness to false for special transaction types that legitimately have no inputs.
558+
// Dash Core doesn't support BIP141 SegWit.
558559
if self.tx_type() == TransactionType::AssetUnlock {
559560
have_witness = false;
560561
}
562+
if self.tx_type() == TransactionType::QuorumCommitment {
563+
have_witness = false;
564+
}
565+
if self.tx_type() == TransactionType::MnhfSignal {
566+
have_witness = false;
567+
}
568+
if self.tx_type() == TransactionType::Coinbase {
569+
have_witness = false;
570+
}
561571
if !have_witness {
562572
len += self.input.consensus_encode(w)?;
563573
len += self.output.consensus_encode(w)?;
@@ -594,7 +604,8 @@ impl Decodable for Transaction {
594604
let input = Vec::<TxIn>::consensus_decode_from_finite_reader(r)?;
595605
// segwit
596606
let mut segwit = input.is_empty();
597-
// Forcing segwit to false for AssetUnlock, as currently Core doesn't support BIP141 SegWit.
607+
// Forcing segwit to false for special transaction types that legitimately have no inputs.
608+
// Dash Core doesn't support BIP141 SegWit.
598609
if special_transaction_type == TransactionType::AssetUnlock {
599610
segwit = false;
600611
}
@@ -604,6 +615,9 @@ impl Decodable for Transaction {
604615
if special_transaction_type == TransactionType::MnhfSignal {
605616
segwit = false;
606617
}
618+
if special_transaction_type == TransactionType::Coinbase {
619+
segwit = false;
620+
}
607621
if segwit {
608622
let segwit_flag = u8::consensus_decode_from_finite_reader(r)?;
609623
match segwit_flag {

0 commit comments

Comments
 (0)