Fix socketio getDetailedTransaction

This commit is contained in:
Martin Boehm 2018-05-09 12:27:20 +02:00
parent f1d7d6b023
commit 124e670257

View File

@ -311,7 +311,7 @@ type txOutputs struct {
Script *string `json:"script"` Script *string `json:"script"`
// ScriptAsm *string `json:"scriptAsm"` // ScriptAsm *string `json:"scriptAsm"`
SpentTxID *string `json:"spentTxId,omitempty"` SpentTxID *string `json:"spentTxId,omitempty"`
SpentIndex int `json:"spentIndex"` SpentIndex int `json:"spentIndex,omitempty"`
SpentHeight int `json:"spentHeight,omitempty"` SpentHeight int `json:"spentHeight,omitempty"`
Address *string `json:"address"` Address *string `json:"address"`
} }
@ -394,10 +394,10 @@ func (s *SocketIoServer) getAddressHistory(addr []string, opts *addrOpts) (res r
hi := make([]txInputs, 0) hi := make([]txInputs, 0)
ho := make([]txOutputs, 0) ho := make([]txOutputs, 0)
for _, vout := range tx.Vout { for _, vout := range tx.Vout {
aoh := vout.ScriptPubKey.Hex
ao := txOutputs{ ao := txOutputs{
Satoshis: int64(vout.Value * 1E8), Satoshis: int64(vout.Value * 1E8),
Script: &vout.ScriptPubKey.Hex, Script: &aoh,
SpentIndex: int(vout.N),
} }
if vout.Address != nil { if vout.Address != nil {
a, err := vout.Address.EncodeAddress(opts.AddressFormat) a, err := vout.Address.EncodeAddress(opts.AddressFormat)
@ -644,8 +644,9 @@ func (s *SocketIoServer) getDetailedTransaction(txid string, opts txOpts) (res r
hi := make([]txInputs, 0) hi := make([]txInputs, 0)
ho := make([]txOutputs, 0) ho := make([]txOutputs, 0)
for _, vin := range tx.Vin { for _, vin := range tx.Vin {
ais := vin.ScriptSig.Hex
ai := txInputs{ ai := txInputs{
Script: &vin.ScriptSig.Hex, Script: &ais,
Sequence: int64(vin.Sequence), Sequence: int64(vin.Sequence),
OutputIndex: int(vin.Vout), OutputIndex: int(vin.Vout),
} }
@ -669,10 +670,10 @@ func (s *SocketIoServer) getDetailedTransaction(txid string, opts txOpts) (res r
hi = append(hi, ai) hi = append(hi, ai)
} }
for _, vout := range tx.Vout { for _, vout := range tx.Vout {
aos := vout.ScriptPubKey.Hex
ao := txOutputs{ ao := txOutputs{
Satoshis: int64(vout.Value * 1E8), Satoshis: int64(vout.Value * 1E8),
Script: &vout.ScriptPubKey.Hex, Script: &aos,
// SpentIndex: int(vout.N),
} }
if vout.Address != nil { if vout.Address != nil {
a, err := vout.Address.EncodeAddress(opts.AddressFormat) a, err := vout.Address.EncodeAddress(opts.AddressFormat)