From 46c9af8b50860e5f2d33acdc09863eeb639580bb Mon Sep 17 00:00:00 2001 From: Odysseas Gabrielides Date: Wed, 30 Oct 2024 16:33:24 +0200 Subject: [PATCH] fix: CoinbasePayload.best_cl_height as compactsize --- .../transaction/special_transaction/coinbase.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dash/src/blockdata/transaction/special_transaction/coinbase.rs b/dash/src/blockdata/transaction/special_transaction/coinbase.rs index b99305a62f..e26b9d3144 100644 --- a/dash/src/blockdata/transaction/special_transaction/coinbase.rs +++ b/dash/src/blockdata/transaction/special_transaction/coinbase.rs @@ -93,7 +93,14 @@ impl Decodable for CoinbasePayload { let height = u32::consensus_decode(r)?; let merkle_root_masternode_list = MerkleRootMasternodeList::consensus_decode(r)?; let merkle_root_quorums = MerkleRootQuorums::consensus_decode(r)?; - let best_cl_height = if version >= 3 { Some(u32::consensus_decode(r)?) } else { None }; + let best_cl_height = if version >= 3 { + let value = u8::consensus_decode(r)?; + match value { + 253 => Some(u16::consensus_decode(r)? as u32), + 254 => Some(u32::consensus_decode(r)?), + _ => Some(value as u32) + } + } else { None }; let best_cl_signature = if version >= 3 { Some(BLSSignature::consensus_decode(r)?) } else { None }; let asset_locked_amount = if version >= 3 { Some(u64::consensus_decode(r)?) } else { None };