parser: stop sending non-Sapling transactions (e.g. coinbase) in compact block vtx

This commit is contained in:
George Tankersley 2018-12-11 21:58:43 +00:00
parent f0c2405593
commit f35e72923a
3 changed files with 19 additions and 14 deletions

View File

@ -75,10 +75,15 @@ func (b *block) ToCompact() *rpc.CompactBlock {
Hash: b.GetEncodableHash(),
//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 {
compactBlock.Vtx[idx] = tx.ToCompact(idx)
if tx.HasSaplingTransactions() {
saplingTxns = append(saplingTxns, tx.ToCompact(idx))
}
}
compactBlock.Vtx = saplingTxns
return compactBlock
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long