func (u unspentTransactions) GetInputValue(input structures.TXInput) (float64, error) {
	uodb, err := u.DB.GetUnspentOutputsObject()
	if err != nil {
		return 0, err
	}
	outsBytes, err := uodb.GetDataForTransaction(input.Txid)
	if err != nil {
		u.Logger.Trace.Printf("Data reading error: %s", err.Error())
		return 0, err
	}
	if outsBytes == nil {
		return 0, NewTXNotFoundUOTError("Input TX is not found in unspent outputs")
	}
	outs, err := u.deserializeOutputs(outsBytes)
	if err != nil {
		return 0, err
	}
	for _, o := range outs {
		if o.OIndex == input.Vout {
			return o.Value, nil
		}
	}
	return 0, errors.New("Output index is not found in unspent outputs")
}
CGet input value. Input is unspent TX output
package transactions
import (
	"bytes"
	"encoding/gob"
	"encoding/hex"
	"errors"
	"log"
	"sort"
	"github.com/gelembjuk/democoin/lib/utils"
	"github.com/gelembjuk/democoin/lib/wallet"
	"github.com/gelembjuk/democoin/node/blockchain"
	"github.com/gelembjuk/democoin/node/database"
	"github.com/gelembjuk/democoin/node/structures"
)
type unspentTransactions struct {
	DB     database.DBManager
	Logger *utils.LoggerMan
}
func (u unspentTransactions) newTransactionIndex() *transactionsIndex {
	return newTransactionIndex(u.DB, u.Logger)
}
func (u unspentTransactions) serializeOutputs(outs []structures.TXOutputIndependent) ([]byte, error) {
	var buff bytes.Buffer
	enc := gob.NewEncoder(&buff)
	err := enc.Encode(outs)
	if err != nil {
		return nil, err
	}
	return buff.Bytes(), nil
}
func (u unspentTransactions) deserializeOutputs(data []byte) ([]structures.TXOutputIndependent, error) {
	var outputs []structures.TXOutputIndependent
	dec := gob.NewDecoder(bytes.NewReader(data))
	err := dec.Decode(&outputs)
	if err != nil {
		return nil, err
		log.Panic(err)
	}
	return outputs, nil
}
func (u unspentTransactions) GetAddressBalance(address string) (float64, error) {
	if address == "" {
		return 0, errors.New("Address is missed")
	}
	w := wallet.Wallet{}
	if !w.ValidateAddress(address) {
		return 0, errors.New("Address is not valid")
	}
	balance := float64(0)
	UnspentTXs, err2 := u.GetunspentTransactionsOutputs(address)
	if err2 != nil {
		return 0, err2
	}
	for _, out := range UnspentTXs {
		balance += out.Value
	}
	return balance, nil
}