Skip to content

Match Bitcoin Core utxo serialization #277

@dergoegge

Description

@dergoegge

We should change the way we serialize utxos to match Bitcoin Core:

https://github.com/bitcoin/bitcoin/blob/398dd678338971d2189934713c83c184742f293f/src/coins.h#L60-L65

vs ours:

utreexo/btcacc/leaf.go

Lines 75 to 82 in 2faac6f

err = binary.Write(w, binary.BigEndian, hcb)
err = binary.Write(w, binary.BigEndian, l.Amt)
if len(l.PkScript) > 10000 {
err = fmt.Errorf("pksize too long")
return
}
err = binary.Write(w, binary.BigEndian, uint16(len(l.PkScript)))
_, err = w.Write(l.PkScript)

This has several benfits:

  • its easier to make the utcd node and Bitcoin Core bridge i am working on compatible.
  • saves bandwidth because of the compression that core uses

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions