From d3b76da91993c226e9e05c3a63d455a2997c0006 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Fri, 27 Dec 2013 12:20:31 -0600 Subject: [PATCH] Make ScriptSig anonymous struct an exported type. The previous commit modified the Vin ScriptSig field to be a pointer to an anonymous struct so it could be properly omitted. However, the callers need to be able to create a new object to assign to the field, so this commit makes the previous anonymous struct an exported type named ScriptSig. --- jsonapi.go | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index b850c151..a88304c6 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -88,17 +88,22 @@ type TxRawDecodeResult struct { Vout []Vout `json:"vout"` } +// ScriptSig models a signature script. It is defined seperately since it only +// applies to non-coinbase. Therefore the field in the Vin structure needs +// to be a pointer. +type ScriptSig struct { + Asm string `json:"asm"` + Hex string `json:"hex"` +} + // Vin models parts of the tx data. It is defined seperately since both // getrawtransaction and decoderawtransaction use the same structure. type Vin struct { - Coinbase string `json:"coinbase,omitempty"` - Txid string `json:"txid,omitempty"` - Vout int `json:"vout,omitempty"` - ScriptSig *struct { - Asm string `json:"asm"` - Hex string `json:"hex"` - } `json:"scriptSig,omitempty"` - Sequence float64 `json:"sequence"` + Coinbase string `json:"coinbase,omitempty"` + Txid string `json:"txid,omitempty"` + Vout int `json:"vout,omitempty"` + ScriptSig *ScriptSig `json:"scriptSig,omitempty"` + Sequence float64 `json:"sequence"` } // Vout models parts of the tx data. It is defined seperately since both