Handle transactions without input txid (newly minted coins)
This commit is contained in:
parent
7db39fcc13
commit
32626851e0
@ -381,28 +381,30 @@ func (s *SocketIoServer) getAddressHistory(addr []string, rr *reqRange) (res res
|
|||||||
Sequence: int64(vin.Sequence),
|
Sequence: int64(vin.Sequence),
|
||||||
OutputIndex: int(vin.Vout),
|
OutputIndex: int(vin.Vout),
|
||||||
}
|
}
|
||||||
otx, err := s.chain.GetTransaction(vin.Txid)
|
if vin.Txid != "" {
|
||||||
if err != nil {
|
otx, err := s.chain.GetTransaction(vin.Txid)
|
||||||
return res, err
|
if err != nil {
|
||||||
}
|
return res, err
|
||||||
if len(otx.Vout) > int(vin.Vout) {
|
}
|
||||||
vout := otx.Vout[vin.Vout]
|
if len(otx.Vout) > int(vin.Vout) {
|
||||||
if len(vout.ScriptPubKey.Addresses) == 1 {
|
vout := otx.Vout[vin.Vout]
|
||||||
a := vout.ScriptPubKey.Addresses[0]
|
if len(vout.ScriptPubKey.Addresses) == 1 {
|
||||||
ai.Address = &a
|
a := vout.ScriptPubKey.Addresses[0]
|
||||||
if stringInSlice(a, addr) {
|
ai.Address = &a
|
||||||
hi, ok := ads[a]
|
if stringInSlice(a, addr) {
|
||||||
if ok {
|
hi, ok := ads[a]
|
||||||
hi.InputIndexes = append(hi.InputIndexes, int(vout.N))
|
if ok {
|
||||||
} else {
|
hi.InputIndexes = append(hi.InputIndexes, int(vout.N))
|
||||||
hi := addressHistoryIndexes{}
|
} else {
|
||||||
hi.InputIndexes = append(hi.InputIndexes, int(vout.N))
|
hi := addressHistoryIndexes{}
|
||||||
hi.OutputIndexes = make([]int, 0)
|
hi.InputIndexes = append(hi.InputIndexes, int(vout.N))
|
||||||
ads[a] = hi
|
hi.OutputIndexes = make([]int, 0)
|
||||||
|
ads[a] = hi
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ai.Satoshis = int64(vout.Value * 1E8)
|
||||||
}
|
}
|
||||||
ai.Satoshis = int64(vout.Value * 1E8)
|
|
||||||
}
|
}
|
||||||
hi = append(hi, ai)
|
hi = append(hi, ai)
|
||||||
}
|
}
|
||||||
@ -608,16 +610,18 @@ func (s *SocketIoServer) getDetailedTransaction(txid string) (res resultGetDetai
|
|||||||
Sequence: int64(vin.Sequence),
|
Sequence: int64(vin.Sequence),
|
||||||
OutputIndex: int(vin.Vout),
|
OutputIndex: int(vin.Vout),
|
||||||
}
|
}
|
||||||
otx, err := s.chain.GetTransaction(vin.Txid)
|
if vin.Txid != "" {
|
||||||
if err != nil {
|
otx, err := s.chain.GetTransaction(vin.Txid)
|
||||||
return res, err
|
if err != nil {
|
||||||
}
|
return res, err
|
||||||
if len(otx.Vout) > int(vin.Vout) {
|
}
|
||||||
vout := otx.Vout[vin.Vout]
|
if len(otx.Vout) > int(vin.Vout) {
|
||||||
if len(vout.ScriptPubKey.Addresses) == 1 {
|
vout := otx.Vout[vin.Vout]
|
||||||
ai.Address = &vout.ScriptPubKey.Addresses[0]
|
if len(vout.ScriptPubKey.Addresses) == 1 {
|
||||||
|
ai.Address = &vout.ScriptPubKey.Addresses[0]
|
||||||
|
}
|
||||||
|
ai.Satoshis = int64(vout.Value * 1E8)
|
||||||
}
|
}
|
||||||
ai.Satoshis = int64(vout.Value * 1E8)
|
|
||||||
}
|
}
|
||||||
hi = append(hi, ai)
|
hi = append(hi, ai)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user