MCPcopy Create free account
hub / github.com/chain/Core / writeTo

Method writeTo

protocol/bc/legacy/txinput.go:205–232  ·  view source on GitHub ↗
(w io.Writer, serflags uint8)

Source from the content-addressed store, hash-verified

203}
204
205func (t *TxInput) writeTo(w io.Writer, serflags uint8) error {
206 _, err := blockchain.WriteVarint63(w, t.AssetVersion)
207 if err != nil {
208 return errors.Wrap(err, "writing asset version")
209 }
210
211 _, err = blockchain.WriteExtensibleString(w, t.CommitmentSuffix, func(w io.Writer) error {
212 return t.WriteInputCommitment(w, serflags)
213 })
214
215 if err != nil {
216 return errors.Wrap(err, "writing input commitment")
217 }
218
219 _, err = blockchain.WriteVarstr31(w, t.ReferenceData)
220 if err != nil {
221 return errors.Wrap(err, "writing reference data")
222 }
223
224 if serflags&SerWitness != 0 {
225 _, err = blockchain.WriteExtensibleString(w, t.WitnessSuffix, t.writeInputWitness)
226 if err != nil {
227 return errors.Wrap(err, "writing input witness")
228 }
229 }
230
231 return nil
232}
233
234func (t *TxInput) WriteInputCommitment(w io.Writer, serflags uint8) error {
235 if t.AssetVersion != 1 {

Callers

nothing calls this directly

Calls 1

WriteInputCommitmentMethod · 0.95

Tested by

no test coverage detected