Example #1
0
// GetUxOutByID gets UxOut by hash id.
func (gw *Gateway) GetUxOutByID(id cipher.SHA256) (*historydb.UxOutJSON, error) {
	var uxout *historydb.UxOut
	var err error
	c := make(chan struct{})
	gw.Requests <- func() {
		uxout, err = gw.V.GetUxOutByID(id)
		c <- struct{}{}
	}
	<-c
	return historydb.NewUxOutJSON(uxout), err
}
Example #2
0
// GetAddrUxOuts gets all the address affected UxOuts.
func (gw *Gateway) GetAddrUxOuts(addr cipher.Address) ([]*historydb.UxOutJSON, error) {
	var (
		uxouts []*historydb.UxOut
		err    error
	)
	c := make(chan struct{})
	gw.Requests <- func() {
		uxouts, err = gw.V.GetAddrUxOuts(addr)
		c <- struct{}{}
	}
	<-c
	uxs := make([]*historydb.UxOutJSON, len(uxouts))
	for i, ux := range uxouts {
		uxs[i] = historydb.NewUxOutJSON(ux)
	}
	return uxs, err
}