Fix lightwalletd sync loop for DragonX wallet

- Handle missing Sapling upgrade in getblockchaininfo response by
  defaulting activation height to 1 (DragonX has Sapling active from
  genesis but uses NO_ACTIVATION_HEIGHT in chainparams)
- Override consensus branch ID to Sapling (76b809bb) when node reports
  Sprout (00000000) due to disabled activation heights
- Include full serialized block header in CompactBlock so the SDK can
  validate hashFinalSaplingRoot against the Sapling commitment tree
- Set CompactBlock ProtoVersion to 1
This commit is contained in:
2026-03-20 06:24:54 -05:00
parent f4ef38c42f
commit ebc38c9369

View File

@@ -99,12 +99,14 @@ func (b *Block) GetPrevHash() []byte {
}
func (b *Block) ToCompact() *walletrpc.CompactBlock {
headerBytes, _ := b.hdr.MarshalBinary()
compactBlock := &walletrpc.CompactBlock{
//TODO ProtoVersion: 1,
Height: uint64(b.GetHeight()),
PrevHash: b.hdr.HashPrevBlock,
Hash: b.GetEncodableHash(),
Time: b.hdr.Time,
ProtoVersion: 1,
Height: uint64(b.GetHeight()),
PrevHash: b.hdr.HashPrevBlock,
Hash: b.GetEncodableHash(),
Time: b.hdr.Time,
Header: headerBytes,
}
// Only Sapling transactions have a meaningful compact encoding