parser: stop sending non-Sapling transactions (e.g. coinbase) in compact block vtx
This commit is contained in:
@@ -75,10 +75,15 @@ func (b *block) ToCompact() *rpc.CompactBlock {
|
|||||||
Hash: b.GetEncodableHash(),
|
Hash: b.GetEncodableHash(),
|
||||||
//TODO Time: b.hdr.Time,
|
//TODO Time: b.hdr.Time,
|
||||||
}
|
}
|
||||||
compactBlock.Vtx = make([]*rpc.CompactTx, len(b.vtx))
|
|
||||||
|
// Only Sapling transactions have a meaningful compact encoding
|
||||||
|
saplingTxns := make([]*rpc.CompactTx, 0, len(b.vtx))
|
||||||
for idx, tx := range b.vtx {
|
for idx, tx := range b.vtx {
|
||||||
compactBlock.Vtx[idx] = tx.ToCompact(idx)
|
if tx.HasSaplingTransactions() {
|
||||||
|
saplingTxns = append(saplingTxns, tx.ToCompact(idx))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
compactBlock.Vtx = saplingTxns
|
||||||
return compactBlock
|
return compactBlock
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
12
parser/testdata/compact_blocks.json
vendored
12
parser/testdata/compact_blocks.json
vendored
File diff suppressed because one or more lines are too long
12
storage/testdata/compact_blocks.json
vendored
12
storage/testdata/compact_blocks.json
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user